Announcement

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

  • twoway graph adds random line at bottom

    Hello,

    I have a little problem which I could not solve yet: when creating a graph with the twoway command, Stata (version 11.2) adds a random line at the bottom of my graph when I copy the graph into Word 2010 (as Windows Enhanced Metafile). The line appears about 5cm below the legend. The line is not displayed in the Stata output window; only when I copy and paste the graph into Word. This is what I got:

    Code:
    twoway scatter average_x year, msymbol(smdiamond) mlcolor(black) mfcolor(white) ///
        msize(medium) connect(l) clcolor(black) clwidth(medthick) || ///
        scatter average_y year, msymbol(smdiamond) mlcolor(gs10) mfcolor(white) ///
        msize(medium) connect(l) clcolor(gs10) clwidth(medthick) ///
        xline(1997, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
        yline(0, lcolor(black) lwidth(thin)) ///
        xlabel(#8) graphregion(color(white)) bgcolor(white) ///
        xscale(titlegap(2)) ///
        ytitle("Comparison Averages") ///
        legend(label(1 "Average X") label(2 "Average Y")) ///
        ylabel(4[1]9,format(%9.1fc) glcolor(gs15)) ///
        yscale(titlegap(2) range(4 9))
    When I use a pretty similar code, without a legend, I do not encounter a problem. This would be the other code (without a random line).

    Code:
    twoway scatter difference year, msymbol(smdiamond) mlcolor(black) mfcolor(white) ///
        msize(medium) connect(l) clcolor(black) clwidth(medthick) || ///
        line limit year, lcolor(gs10) lwidth(medthick) ///
        xline(1997, lcolor(gs10) lpattern(dash) lwidth(thin)) ///
        yline(0, lcolor(black) lwidth(thin)) ///
        xlabel(#8) graphregion(color(white)) bgcolor(white) ///
        xscale(titlegap(2)) ///
        ytitle("Yearly Difference") legend(off) ///
        ylabel(-1[1]3,format(%9.1fc) glcolor(gs15)) ///
        yscale(titlegap(2) range(-1 3))
    Maybe you have an idea...

    Thank you!

    Best

  • #2
    I suspect the horizontal line you got in your original question is at y=0, as you asked for that line with the option yline(0, lcolor(black) lwidth(thin)). The main trick with fixing such problems is to add options one at the time and see when the problem occurs. After that it is usually pretty obvious what the problem is and how to fix it.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      yes, that did the trick. Should've seen it, thanks for pointing it out!

      Comment

      Working...
      X