Dear Statalisters,
I appear to be running into a problem that had been encountered by other people on the old statalist: http://www.stata.com/statalist/archi.../msg00943.html. If one attempts to overlay bars with twoway bar and to use the lpattern() option, the outcome is not satisfactory.
The outcome is not so bad with histograms. For example, with:
use http://www.ats.ucla.edu/stat/data/hsbdemo, clear
twoway (histogram write if female==1, start(30) width(5) color(green)) ///
(histogram write if female==0, start(30) width(5) ///
fcolor(none) lcolor(black)), legend(order(1 "Female" 2 "Male" )) name(first)
twoway (histogram write if female==1, start(30) width(5) color(green)) ///
(histogram write if female==0, start(30) width(5) ///
fcolor(none) lcolor(black) lpattern(dash)), legend(order(1 "Female" 2 "Male" )) name (second) the second plot has dashed contour lines, but there is a weird line going from (32.5, 0) to (65,0.18).
With twoway bar, the outcome is very unsatisfactory, since only the contour line of the box in the legend is dashed:
clear
sysuse sp500
gen noise = rnormal(0,200) gen volume_w_noise = volume + noise
twoway (bar volume date, color(green)) /// (bar volume_w_noise date, fcolor(none) lcolor(black) lpattern(dash)) /// in 1/52
I really like the strategy of overlaying one bar plot with fcolor(none) and lcolor(black) with another bar plot with color(green) because I then put this graph of an overlaid plot of bars at the bottom of a plot of overlaid lines to look at two dimensions of time-series of two objects that I am comparing, and overlaying the bar plots is the best way to line things up between the plot of lines and the plot of bars.
Any suggestion of ways to fix the problem with twoway bar and the lpattern() option or alternative plotting scheme would be appreciated.
Thanks!
I appear to be running into a problem that had been encountered by other people on the old statalist: http://www.stata.com/statalist/archi.../msg00943.html. If one attempts to overlay bars with twoway bar and to use the lpattern() option, the outcome is not satisfactory.
The outcome is not so bad with histograms. For example, with:
use http://www.ats.ucla.edu/stat/data/hsbdemo, clear
twoway (histogram write if female==1, start(30) width(5) color(green)) ///
(histogram write if female==0, start(30) width(5) ///
fcolor(none) lcolor(black)), legend(order(1 "Female" 2 "Male" )) name(first)
twoway (histogram write if female==1, start(30) width(5) color(green)) ///
(histogram write if female==0, start(30) width(5) ///
fcolor(none) lcolor(black) lpattern(dash)), legend(order(1 "Female" 2 "Male" )) name (second) the second plot has dashed contour lines, but there is a weird line going from (32.5, 0) to (65,0.18).
With twoway bar, the outcome is very unsatisfactory, since only the contour line of the box in the legend is dashed:
clear
sysuse sp500
gen noise = rnormal(0,200) gen volume_w_noise = volume + noise
twoway (bar volume date, color(green)) /// (bar volume_w_noise date, fcolor(none) lcolor(black) lpattern(dash)) /// in 1/52
I really like the strategy of overlaying one bar plot with fcolor(none) and lcolor(black) with another bar plot with color(green) because I then put this graph of an overlaid plot of bars at the bottom of a plot of overlaid lines to look at two dimensions of time-series of two objects that I am comparing, and overlaying the bar plots is the best way to line things up between the plot of lines and the plot of bars.
Any suggestion of ways to fix the problem with twoway bar and the lpattern() option or alternative plotting scheme would be appreciated.
Thanks!
Comment