Announcement

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

  • Graphs with same width, but different height

    Hey,

    I'd like to create two graphs with the same width, but the second one is supposed to have only 75% of the height of the first one. I'd like everything else (e.g. font size of labels) to be the same.

    I use the following code:
    Code:
    webuse grunfeld, clear 
    gen Yraw = log(invest) 
    keep if company < 5 
    
    egen reference = total((company == 4) * Yraw) , by(year) 
    
    gen Ydiff = Yraw - reference if company < 4 
    
    keep Y* company year 
    
    reshape wide Yraw Ydiff, i(year) j(company)
    
    tsline Yraw*, legend(off) tlabel(,grid nolabel) xsize(5) ysize(4)
    tsline Ydiff*, tlabel(,grid) xsize(5) ysize(3)
    Stata seems to "fix" the height of the saved png-files, leading to different widths in this case. If I specify width and height manually when saving the files the fonts do NOT have the same sizes, i.e. the second image is not just the first one with smaller height.

    How do I get two images with same font sizes etc., where the second one has just a smaller height than in the first case?

    Thanks in advance!

    Best,
    Thomas

  • #2
    I'm not I've never set xsize or ysize and I thought Stata automatically gave me the same size graphs.

    tsline Yraw*, legend(off) tlabel(,grid nolabel)
    tsline Ydiff*, legend(off) tlabel(,grid nolabel)

    Gives identical sized graphs when I paste them into Word. Maybe your problem is that you have different labels etc. in the two.

    Comment


    • #3
      Nick Cox, can you help?

      My question is basically referring to a different problem I have:
      https://www.statalist.org/forums/for...-of-each-other

      Comment

      Working...
      X