Announcement

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

  • centering in graph combine


    How can I make the two lower graphs (nox and voc) to be at the center instead of on the left-hand side?

    Code:
    graph combine pm10 co so2 nox voc
    Attached Files

  • #2
    You can't
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Not the question, but I'd use suffix notation (e.g. "SO[sub:2}" and "NO{sub:x}") when appropriate in graph titles.

      Comment


      • #4
        You can do something like this:

        Code:
        // create basic graphs
        sysuse auto, clear
        forval i=1/5 {
             scatter mpg weight if rep78==`i', name(r`i', replace) title("Rep78 == `i'") aspect(1)
        }
        
        //create rows separately
        graph combine r1 r2 r3, rows(1) name(row1, replace)
        graph combine r4 r5, rows(1) name(row2, replace)
        
        //combine the rows
        graph combine row1 row2, cols(1)
        Click image for larger version

Name:	junk1.png
Views:	1
Size:	64.8 KB
ID:	1412439


        You can fiddle with graphregion margins on the second-row graphs if you want them closer together; e.g.:

        Code:
        scatter mpg weight if rep78==4, name(r4x, replace) title("Rep78 == 4") aspect(1) graphregion(margin(l 40))
        scatter mpg weight if rep78==5, name(r5x, replace) title("Rep78 == 5") aspect(1) graphregion(margin(r 40))
        graph combine r4x r5x, name(row2x, replace) row(1)
        graph combine row1 row2x, cols(1)
        Click image for larger version

Name:	junk2.png
Views:	1
Size:	63.1 KB
ID:	1412438

        Comment


        • #5
          Oh, meant to say: the -aspect()- option ensures all the plots have the same aspect ratio; without it the first and second row plots will end up with different shapes. But it need not be 1 - you can set it to whatever you like to make the resulting combined graph look good.

          Comment

          Working...
          X