Announcement

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

  • Graph combine: getting all plots on the same level with one common y axis

    Hi Statalist,

    So here are my two issues:

    1. I have to make three separate figures and line them up using graph combine. These have to be presented in panels, so all three graphs are on the same level (rather than two above and one below as seems to be the default in stata)

    2. Do I have to scale them separately so they're all a similar shape and size? At the moment, the graph that has the labels on the y axis is smaller than the others.


    This is was i've done:


    twoway (scatter variable1 mgroup if country ==1, yline(0.114, lpattern("-"))), legend(off) xlabel(2 3 4 5, valuelabel angle(45)) xscale(range(1 6)) title("Country1") ytitle("") ylabel(0.06 (0.01) 0.18, nolab notick) xtitle("") saving(variable1_1549_2015_1, replace)

    twoway (scatter variable1 mgroup if country ==2, yline(0.134, lpattern("-"))), legend(off) xlabel(1 2 3, valuelabel angle(45)) xscale(range(0 4)) title("Country2") ytitle("") ylabel(0.06 (0.01) 0.18, nolab notick) xtitle("") saving(variable1_1549_2015_2, replace)

    twoway (scatter variable1 mgroup if country ==3, yline(0.1, lpattern("-"))), legend(off) xscale(range(0 3)) xlabel(1 2, valuelabel angle(45)) title("Country3") ytitle("") ylabel(0.06 (0.01) 0.18) xtitle("") saving(variable1_1549_2015_3, replace)

    graph combine "Q:\Model_Evaluation\figures\all_groups\File\v aria ble1_1549_2015_3.gph" "Q:\Model_Evaluation\figures\all_groups\File\v aria ble1_1549_2015_1.gph" "Q:\Model_Evaluation\figures\all_groups\File\v aria ble1_1549_2015_2.gph", iscale(0.5) graphregion(margin(l=80)) ycommon xcommon
    Thank you for your help!

  • #2
    It is entirely up to you want the 'yscale' same for all or not. If you have per-defined same yscale for all of them, then 'ycommon' has nothing to do in the 'graph combine' option. This will work when you have not predefined same-y for all the graphs. Using the option 'col(3)' or 'row(1)' after 'graph combine' will let you have all of them in a single panel:

    Code:
    graph combine graph1 graph2 graph3, iscale(0.5) graphregion(margin(l=80)) ycommon xcommon col(3)
    Roman

    Comment


    • #3
      Hi Roman,

      Thank you very much! That's the option that I was looking for

      Comment


      • #4
        Coming late to this thread: Can you post the data?

        When I see an option like

        Code:
        xla(, valuelabel ang(45))
        I guess that people are trying to cope with long value labels. At that point the battle is often lost already. Why not flip the axes round? Value labels will be easier to read horizontally on the y axis.

        Or even try something like

        Code:
        gen ylevel = cond(country == 1, 0.114, cond(country == 2, 0.134, cond(country == 3, 0.1, .)))
        
        graph dot (asis) variable1 ylevel, over(mgroup) over(country) nofill ytitle("") xtitle("") marker(1, ms(Oh)) marker(2, ms(|))



        Comment

        Working...
        X