Announcement

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

  • move CI behind scatterplot

    Could anyone help me move the confidence interval which I plotted with the command - lpolyci - behind the scatter plot?

    The code I run so far is
    Code:
    twoway scatter percap_total1 prop60plus1 if year==2015, ///
    msymbol(p) mla(location) mlabsiz(tiny) mcolor(blue*1.3) mlabcol(blue*1.3) || ///
    scatter percap_total2 prop60plus2 if year==2015, ///
    msymbol(o) mla(location) mlabsiz(tiny) mcolor(red*1.2) mlabcol(red*1.2) || ///
    lpolyci percap_total prop60plus if year==2015, degree(2) nofit ///
    ytitle("health spending per capita") xtitle("% population > 60 years old") ///
    ylab(0(2000)10000, grid) ysc(range(0 10000)) ylab(,labsize(vsmall) format(%15.0fc)) ///
    xlab(0(5)35, grid) xsc(range(0 35)) xlab(,labsize(vsmall)) ///
    graphregion(color(white)) legend(off) name(graf_disp, replace)
    Click image for larger version

Name:	graf_disp.png
Views:	1
Size:	63.8 KB
ID:	1446842


  • #2
    Try reversing the order or using lines or opaque area for the CI:

    Code:
    sysuse auto, clear
    tw (lpolyci price mpg) (scatter price mpg)
    tw (lpolyci price mpg, fitplot(line) ciplot(rline)) (scatter price mpg)
    tw (lpolyci price mpg, color(%10) fitplot(line)) (scatter price mpg)

    Comment

    Working...
    X