Hello,
I'm encountering an issue when using the graph combine command to arrange a set of graphs in a grid layout. Specifically, I want to display 10 graphs in a 2x2 layout for visual balance. This is done by producing 3 combined graphs: the first 2 have 4 graphs each and the third has the remaining 2 graphs. However, since the final row contains just two graphs (i.e., a 2x1 grid), Stata stretches the height of these graphs to fill the space, distorting the aspect ratio.
Below is a reproducible example that illustrates the problem:
In the first combined graph (4 graphs in a 2x2 layout), the aspect ratio is preserved as expected. However, in the second combined graph (2 graphs), Stata stretches the graphs vertically, presumably trying to fill space for non-existent graphs 7 and 8.
Is there a way to prevent Stata from stretching the graphs when combining fewer graphs? Ideally, I’d like to keep the same aspect ratio or dimensions as in the earlier graph combine.
Thank you in advance for your help!
Best,
Hélder
I'm encountering an issue when using the graph combine command to arrange a set of graphs in a grid layout. Specifically, I want to display 10 graphs in a 2x2 layout for visual balance. This is done by producing 3 combined graphs: the first 2 have 4 graphs each and the third has the remaining 2 graphs. However, since the final row contains just two graphs (i.e., a 2x1 grid), Stata stretches the height of these graphs to fill the space, distorting the aspect ratio.
Below is a reproducible example that illustrates the problem:
Code:
clear all sysuse auto, clear cd "" // replace with a folder path gen obs_order = _n xtile mygroup = obs_order, n(6) foreach yy of numlist 1/6 { graph bar price foreign if mygroup == `yy' graph save graph_`yy', replace } // This 2x2 layout looks fine – proportions are preserved graph combine graph_1.gph graph_2.gph graph_3.gph graph_4.gph, col(2) row(2) // This 2x1 layout is distorted – vertical stretching occurs graph combine graph_5.gph graph_6.gph, col(2) row(2)
In the first combined graph (4 graphs in a 2x2 layout), the aspect ratio is preserved as expected. However, in the second combined graph (2 graphs), Stata stretches the graphs vertically, presumably trying to fill space for non-existent graphs 7 and 8.
Is there a way to prevent Stata from stretching the graphs when combining fewer graphs? Ideally, I’d like to keep the same aspect ratio or dimensions as in the earlier graph combine.
Thank you in advance for your help!
Best,
Hélder