Announcement

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

  • Graph combine, align x axis

    Hi, I have 3 histograms coming from different databases. I am using graph combine to combine them into one graph as in the picture. I would like to have the x axis aligned. I thought the problem was for not having the title in the first and third histograms. So I added an X to check but it seems that the problem also comes from the labels in the y axis.

    Is there an easy way to align them?

    This is my code:

    graph combine "Writing\hist_obs_tohigh.gph" "Writing\hist_obs_placebo.gph" "Writing\hist_obs_tolow.gph", cols(1) xcommon

    Thank you

    Click image for larger version

Name:	Capture.PNG
Views:	2
Size:	87.9 KB
ID:	1679271

  • #2
    This is an old problem with no easy solution. See https://www.statalist.org/forums/for...-graph-combine

    Comment


    • #3
      Could you increase the scale of your Y axis in the first and third plots to 1000 (and make sure it includes the comma in the format). I know that's not ideal, as it changes the scale quite a bit, but, I think that might fix your problem here. It's hard to say without sample code, but it would look something like this:

      Code:
      hist var1, ylab(0(1000)1000, angle(horizontal) format(%9.0gc)) ysc(range(0 1000)) freq name(hist1, replace)
      hist var2, ylab(,angle(horizontal) format(%9.0gc)) freq name(hist2, replace)
      hist var3, ylab(0(1000)1000, angle(horizontal) format(%9.0gc)) ysc(range(0 1000)) freq name(hist3, replace)
      
      gr combine hist1 hist2 hist3, cols(1) xcommon
      Last edited by amandacpac; 25 Aug 2022, 20:01.

      Comment


      • #4
        See https://journals.sagepub.com/doi/ful...36867X20976341 for an update to discussion.

        Comment


        • #5
          Thank you all! I ended up changing the angle of the labels, so that I keep the same style format of other graphs in the paper.

          Comment

          Working...
          X