Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Forcing variable row height on graph combine

    Hi, I am trying to combine 8 graphs into 4 rows and 2 columns in stata and can I specify for the bottom row to be taller?

    Code to combine graphs:
    Code:
    gr combine g1.gph g2.gph g3.gph g4.gph g5.gph g6.gph g7.gph g8.gph, col(2) iscale(0.52) xcommon saving("stata output/CS_graphs") ysize(6) commonscheme
    Something like rowheight = 0.2, 0.2, 0.2, 0.4
    Thanks in advance for any advice!
    Last edited by Laurence Jones; 06 Aug 2024, 03:53.

  • #2
    You can combine combined graphs. "0.2 0.2 0.4" is doable, as the third row is twice row 1 and row2. You need to do the math for "0.2 0.2 0.2 0.4". Roughly, combine 3 graphs getting a ratio of \(\frac{1}{3}, \frac{1}{3}, \frac{1}{3}\). Then using gr combine, place a bottom margin equal to \(\frac{1}{3}\) so that the graph occupies \(\frac{2}{3}\) of the plot region. Then the combination will give you \(\frac{1}{3}, \frac{1}{3}, \frac{1}{3}, \frac{2}{3}\) that corresponds to "0.2 0.2 0.2 0.4". Here is an illustration for "0.2 0.2 0.4".

    Code:
    sysuse auto, clear
    scatter mpg weight, saving(gr1, replace)
    
    gr combine gr1.gph gr1.gph, col(2) saving(gr2, replace)
    gr combine gr1.gph gr1.gph gr1.gph gr1.gph, col(2) saving(gr3, replace)
    gr combine gr3.gph gr2.gph, row(2)
    Res.:

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	57.6 KB
ID:	1760851

    Comment

    Working...
    X