Announcement

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

  • twoway area and unwanted outline

    I use twoway area to draw chronograms, and like to suppress the outline of the area, using fill-colour only. However, in interactive mode, Stata puts a black outline around the last category. This does not happen when exported to PDF or EPS, but it is reproduced in export to PNG:

    Click image for larger version

Name:	areatest.png
Views:	4
Size:	190.9 KB
ID:	1503581

    The desired output is as follows (achieved via export to PDF):

    Click image for larger version

Name:	areatest2.png
Views:	1
Size:	37.8 KB
ID:	1503583


    The graphics command is as follows (full example below):

    Code:
    twoway area xx* t, lwidth(none none none none)
    The lwidth() option suppresses the outline of each colour area.

    MWE:

    Code:
    set obs 1000
    gen x = runiformint(1,4)
    gen t = 1 + int((_n-1)/10)
    tab x, gen(xx)
    collapse (sum) xx*, by(t)
    
    replace xx3 = xx3 + xx4
    replace xx2 = xx2 + xx3
    replace xx1 = xx1 + xx2
    
    twoway area xx* t, lwidth(none none none none)
    Attached Files

  • #2
    quite strange. In my case, it won't appear.Here is the png directly exported from Stata.
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	136.5 KB
ID:	1503587

    2B or not 2B, that's a question!

    Comment


    • #3
      Interesting.

      Maybe this is specific to my setup: Linux, Stata 15.1.

      This code gives me a PNG with the black outline, and a PDF without, in interactive graphical Stata:
      Code:
      twoway area xx* t, lwidth(none none none none)
      graph export areatest.png, replace
      graph export areatest.pdf, replace
      (In batch or console Stata, graph export areatest.png gives a "translator Graph2png not found" error.)

      Comment


      • #4
        OK, false alarm: an update all solved the problem. Thanks Liu, for the feedback.

        Comment

        Working...
        X