Hello everybody,
I guess it's a classic and if you can point me to the appropriate earlier thread, I would be very grateful.
Anyway, I have been struggling with this since I first tried to combine graphs in Stata and I have tried everything I could think of, but I still don't get it.
My problem:
I would like to combine three subgraphs in one rows (in this case using Vince Wiggins' grc1leg but it's all the same with graph combine).
I would like the sub graphs to keep an aspect ratio of about 1, i.e. similar x and y size, i.e. about a square shape.
But by default they become rather narrow and tall.
Below you can see some of the various attempts I took trying to follow help graph combine ("Controlling the aspect ratio of subgraphs").
But I could never get to a satisfying result.
The best I could do was attempt B, but I could never get rid of the margin around the subgraphs.
The solution I found was attempt C using post-processing with gr_edit to change the overall x and y length of the combined graph.
But there must be some way to achieve this directly, right?
(Btw: adding xsize(5) ysize(2) as options to grc1leg or graph combine doesn't do the trick).
So, please help me to solve this once and for all!
Thank you in advance and best
Boris
I guess it's a classic and if you can point me to the appropriate earlier thread, I would be very grateful.
Anyway, I have been struggling with this since I first tried to combine graphs in Stata and I have tried everything I could think of, but I still don't get it.
My problem:
I would like to combine three subgraphs in one rows (in this case using Vince Wiggins' grc1leg but it's all the same with graph combine).
I would like the sub graphs to keep an aspect ratio of about 1, i.e. similar x and y size, i.e. about a square shape.
But by default they become rather narrow and tall.
Below you can see some of the various attempts I took trying to follow help graph combine ("Controlling the aspect ratio of subgraphs").
But I could never get to a satisfying result.
The best I could do was attempt B, but I could never get rid of the margin around the subgraphs.
The solution I found was attempt C using post-processing with gr_edit to change the overall x and y length of the combined graph.
But there must be some way to achieve this directly, right?
(Btw: adding xsize(5) ysize(2) as options to grc1leg or graph combine doesn't do the trick).
So, please help me to solve this once and for all!
Thank you in advance and best
Boris
Code:
sysuse auto, clear // findit grc1leg // By Vince Wiggins * A Not good: twoway (scatter price mpg)(scatter gear_ratio turn), name(gr1,replace) twoway (scatter weight trunk), name(gr2,replace) twoway (histogram headroom), name(gr3,replace) grc1leg gr1 gr2 gr3, rows(1) name(not_good,replace) // sub graphs too narrow and tall * B Slightly better: twoway (scatter price mpg)(scatter gear_ratio turn), legend(order(1 "Price")) fysize(50) name(gr1,replace) twoway (scatter weight trunk), fysize(50) name(gr2,replace) twoway (histogram headroom), fysize(50) name(gr3,replace) grc1leg gr1 gr2 gr3, rows(1) imargin(0 0 0 0) name(slightly_better,replace) // Now the subgraphs look nice, but there is a huge margin between them and the surrounding graph * C That's it: twoway (scatter price mpg)(scatter gear_ratio turn), name(gr1,replace) twoway (scatter weight trunk), name(gr2,replace) twoway (histogram headroom), name(gr3,replace) grc1leg gr1 gr2 gr3, rows(1) iscale(1) name(thats_it,replace) gr_edit .style.editstyle declared_ysize(2) editcopy gr_edit .style.editstyle declared_xsize(5) editcopy
Comment