Announcement

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

  • How to solve this Y axis problem...?

    Hi everybody,
    I am new in this network. I am new with Stata. I am using the 15.1 and trying to plot marginal effects... I have almost all done but... I have the problem you can see in the graph. The Y axis is to narrow... How can I change in order my Y axis uses all the complete space in the line? and How can I do in order that the X scale is in the Xline and not out of the graph (see it bellow)... These are the codes I am using:


    graph twoway line conbx MVZ, clpattern(solid) clwidth(thin) clcolor(black)
    || line top MVZ, clpattern(dash) clwidth(thin) clcolor(black)
    || line bottom MVZ, clpattern(dash) clwidth(thin) clcolor(black)
    || line topb MVZ, clpattern(dash) clwidth(thin) clcolor(blue)
    || line bottomb MVZ, clpattern(dash) clwidth(thin) clcolor(blue)
    || line topc MVZ, clpattern(dash) clwidth(thin) clcolor(green)
    || line bottomc MVZ, clpattern(dash) clwidth(thin) clcolor(green)
    || ,
    xlabel(0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5, nogrid labsize(2))
    ylabel(-1.5 -1 -0.5 0 0.5 1 1.5 2.5 3, nogrid labsize(2))
    yscale(line)
    xscale(noline)
    legend(col(1) order(1 3 4 6) label(1 "Marginal Effect of Fiscal Multiplier") label(3 "95% Confidence Interval") label(4 "90% Confidence Interval") label(6 "99% Confidence Interval"))
    yline(0, lcolor(black))
    title("Marginal Effect of Fiscal Multiplier in an Open Economy", size(4))
    subtitle(" " "Dependent Variable: Real GDP Growth Rate" " ", size(3))
    xtitle(Openness level, size(3) )
    xsca(titlegap(2))
    ysca(titlegap(2))
    ytitle("Fiscal Multiplier", size(3))
    scheme(s2mono) graphregion(fcolor(white));

    And this is the graph I obtain... I have changed the Y scale but it always put the numbers in the same little space...:
    Click image for larger version

Name:	ME_Ynarrow.png
Views:	1
Size:	103.8 KB
ID:	1492714


  • #2
    Dear Rafael,

    Please consult the FAQ page, and read the paragraph: 12.2 What to say about your data

    Next: use dataex to provide some sample of your data (i.e. variables).
    That should be helpful for those who possibly can help you.

    ---------------------

    I am not certain what you ask, and I have to guess the minimum and maximum value in your data that is used for the y-scale, but I think that you have to change your label specification to populate your y-axis with useful and readable tick marks:
    Code:
    ylabel(-6(1)6, nogrid labsize(2))
    All the best,
    Eric
    http://publicationslist.org/eric.melse

    Comment


    • #3
      I don't see how you obtained your marginal effects, but it looks like you might have used predict rather than margins. If you are willing to accept one CI per graph, then this would accomplish your goal of eliminating the strange spacing of y-axis values, with simpler syntax. (Using an example Stata dataset):

      Code:
      webuse nhanes2
      regress bpsystol c.age##i.sex
      margins, at(age = (20(5)75))
      marginsplot, recast(line) recastci(rarea) level(99)
      I can't find an easy to get this plot to accommodate 3 CIs of different levels, however.
      Please use the code delimiters to show code and results - use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Please use the command -dataex- to show a representative sample of data; it is installed already if you have Stata 14.2 or 15.1, else you can install it by typing

      Code:
      ssc install dataex

      Comment

      Working...
      X