Is it possible to control the range of the x-axis when combining two graphs with graph combine ..., xcommon? The range of the x-variable (the limits of the intervals) in the data below is from -28 to 28. In the simple graph combine plot, the x-axes range from -30 to 30 which is fine. But when the option xcommon is selected, the range increases from -40 to 40. The data below are made up but in my original data, the large empty spaces in the figure make it difficult to detect any pattern.
The code uses an undocumented feature of twoway bar to allow for varying bin-widths. I mention this, but I am not sure if this information is relevant here. See
I am using Stata 17 on Windows 10.
The code uses an undocumented feature of twoway bar to allow for varying bin-widths. I mention this, but I am not sure if this information is relevant here. See
HTML Code:
https://www.stata.com/support/faqs/graphics/histograms-with-varying-bin-widths/
Code:
clear input species binlim weight 2 -28 34 2 -24 34 2 -20 34 2 -8 24 2 4 . 5 -4 12 5 4 13 5 16 99 5 20 55 5 24 23 5 28 . end twoway (bar weight binlim if species == 2, sort base(0) bartype(spanning)), legend(off) name(gs1, replace) twoway (bar weight binlim if species == 5, sort base(0) bartype(spanning)), legend(off) name(gs2, replace) graph close _all graph combine gs1 gs2, cols(1) xcommon graph combine gs1 gs2, cols(1)
Comment