Announcement

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

  • How to keep plots and their titles/labels of two graphs the same size when using option by() ?

    Hi everyone,
    I want to produce some graphs which are composites with different number of separate panels, like
    Code:
    sysuse auto.dta, clear
    tw scatter price length, by(foreign, row(1)) name(a, replace)
    tw scatter price length, by(rep78, row(2))   name(b, replace)
    Well, as you can see, graph a has two plots in one row, and graph b has five plots in two rows.
    But, I don't know how to keep the separate panels of graph a and b the same size.
    Click image for larger version

Name:	l.jpeg
Views:	1
Size:	24.1 KB
ID:	1676339


    Really appreciate any help.

    Will ZHANG

  • #2
    See https://www.stata-journal.com/articl...article=gr0058 for help.

    Code:
    sysuse auto.dta, clear
    preserve 
    expand 2 
    gen toshow = cond(_n <= 74, rep78, 6 + foreign)
    label def toshow 1 "Record 1" 2 "Record 2" 3 "Record 3" 4 "Record 4" 5 "Record 5" 6 Domestic 7 Foreign 
    label val toshow toshow 
    tw scatter price length, by(toshow, row(3) hole(6) note("")) name(c, replace)
    restore

    Comment


    • #3
      Originally posted by Nick Cox View Post
      See https://www.stata-journal.com/articl...article=gr0058 for help.

      Code:
      sysuse auto.dta, clear
      preserve
      expand 2
      gen toshow = cond(_n <= 74, rep78, 6 + foreign)
      label def toshow 1 "Record 1" 2 "Record 2" 3 "Record 3" 4 "Record 4" 5 "Record 5" 6 Domestic 7 Foreign
      label val toshow toshow
      tw scatter price length, by(toshow, row(3) hole(6) note("")) name(c, replace)
      restore
      Thanks for your reply. I like your book 119 stata tips!
      Your code can really make the separate panels of two graphs the same size.
      But I need the results to be shown in two graphs, so that I need to modify the size of one graph.
      I've found it difficult to make that in stata. Hoping to get help from you.
      Thanks!

      Comment


      • #4
        I suppose you could try specifying xsize() and ysize(). That's not something I've ever wanted or tried to do, so I am guessing.

        Comment

        Working...
        X