I have prepared a bar graph with the following data and code. There are two yvars with different scales so I am using axis(1) and axis(2) and overlaying two graphs. The bars of the overlaid graphs overlap. Now I wish to separate the maroon and white bars so they do not overlap.
Any suggestions would be highly welcome.
Grant
agegrp numptgrp agegr grpop
5-9 869 05-09 27860
10-14 240 10-14 23117
15-19 150 15-19 17725
20-24 104 20-24 16597
25-29 98 25-29 11490
30-34 87 30-34 10328
35-39 80 35-39 6984
40-44 77 40-44 7042
45-49 60 45-49 4960
50-54 51 50-54 3876
55-59 31 55-59 3123
60-64 39 60-64 2270
65-69 30 65-69 1979
70-74 20 70-74 1334
75-79 8 75-79 1038
80-84 9 80-84 515
85-89 0 85-89 437
90-94 4 90-94 173
95-99 4 95-99 97
100-104 0 >=100 34
twoway bar numptgrp agegrp, color(maroon) yaxis(1) ytitle("Number of patients", axis(1) size(*.9)) ylabel(100(100)700, axis(1) labsize(*.9) nogrid) /*
*/ xtitle("Age group, in years", size(*.9)) xlabel(1(1)21, valuelabel labsize(*.8) angle(45)) ysc(titlegap(2)) graphregion(fcolor(white)) || /*
*/ bar grpop agegrp, fcolor(none) lcolor(black) yaxis(2) ylabel(5000 10000 15000 20000 25000 30000, axis(2) labsize(*.9)) /*
*/ ytitle(" " "Basse HDSS population", axis(2) size(*.9)) legend(order(1 "Patients" 2 "Population") position(1) ring(0) rows(2) size(*.9) /*
*/ region(lcolor(white)))
0 Response to graph bar with multiple yvars with different scales
Post a Comment