Announcement

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

  • Sepscatter and qfit

    Hello! I was previously trying to fit a qfit over the sepscatter command but read somewhere that it's not possible because sepscatter not being a twoway type. I'm now trying to recreate the sepscatter code manually but I can't figure out how to get the legend to show (part where it says 2010, 2011 etc). Do anyone know how to solve this?

    My original sepscatter code:
    sepscatter WTI RI, seperate(Year) /*
    */ title("Relationship Between WTI Spot Price" "and Relative Inventory Level") /*
    */ xtitle("Relative Inventory Level", height(6))ytitle("WTI Spot Price") /*
    */ legen(col(3) ring(0) position(1) region(lcolor(white)))/*
    */ ylabel(, angle(0)) /*
    */ ylabel(,nogrid)/*
    */ graphregion(color(white))

    My new code:
    graph twoway (scatter WTI RI if Year=="2010") /*
    */ (scatter WTI RI if Year=="2011")(qfit WTI RI, lcolor(black))/*
    */ (scatter WTI RI if Year=="2012") /*
    */(scatter WTI RI if Year=="2013") /*
    */ (scatter WTI RI if Year=="2014") /*
    */(scatter WTI RI if Year=="2015") /*
    */ (scatter WTI RI if Year=="2016") /*
    */(scatter WTI RI if Year=="2017") /*
    */ (scatter WTI RI if Year=="2018") /*
    */(scatter WTI RI if Year=="Now", mcolor(black) msize(medium-large)), /*
    */ title("Relationship Between WTI Spot Price" "and Relative Inventory Level") /*
    */ xtitle("Relative Inventory Level", height(6))ytitle("WTI Spot Price") /*
    */ legen(col(3) ring(0) position(1) order(1 2) region(lcolor(white))) /*
    */ note("Data Source: EIA Weekly Petroleum Status Report", position(7) ring(0) size(vsmall)) /*
    */ ylabel(, angle(0)) /*
    */ ylabel(,nogrid) /*
    */ graphregion(color(white))

    Click image for larger version

Name:	Color.png
Views:	1
Size:	47.8 KB
ID:	1436751
Working...
X