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)))
Related Posts with graph bar with multiple yvars with different scales
METAN command on log-transformed odds ratiosDear Statalist Member, I have several Effect Sizes (ES) with accompanied 95% Confidence Intervals (…
Plot confidence interval for medianI'd appreciate if anyone could help me with this one. I need to plot median and percentile confidenc…
how to surpress the "graphs by group" when graphing histogram with by optionI do not want to display "graphs by group", Here is the code: Code: * Example generated by -dataex…
Seasonally adjusted GDPI guess this is a simple question. How to get the seasonally adjusted GDP continuously compounded g…
How to filter data using keywordsHi everyone, I am a novice user of STATA. I have collected execucomp data on excel, where manager d…
Subscribe to:
Post Comments (Atom)
0 Response to graph bar with multiple yvars with different scales
Post a Comment