Announcement

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

  • Not a Two-way plot type error

    Hi, I tried to do a scatter plot and my data is like the table below. It's 194 countries/rows
    Country Region Code TaxRevenueasaofGDP LnGDPpercapita

    However, I tried many ways for the code and it always shows that "twoway (scatter TaxRevenueasaofGDP LnGDPpercapita if Country=="Burkina Faso", msymbol(diamond) msize(large) mcolor(lightblue) mlabel(Country) mlabs(vsmall) mlabc(lavender))//
    / / is not a twoway plot type

    r(198)"

    I don't know why it's not a twoway plot type. Can you please give me an advice?


    This is the code I use.

    twoway (scatter TaxRevenueasaofGDP LnGDPpercapita if Country=="Burkina Faso", msymbol(diamond) msize(large) mcolor(lightblue) mlabel(Country) mlabs(vsmall) mlabc(lavender))//
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="Sub-Saharan Africa" & Country!="Burkina Faso", mlabel(Code) msymbol(circle) msize(medium) mcolor(pink))//
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region!="Sub-Saharan Africa", msymbol(circle) msize(medium) mcolor(green))//
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="Latin America & Caribbean", msymbol(circle) msize(medium) mcolor(blue))//
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="Middle East & North Africa", msymbol(circle) msize(medium) mcolor(orange))//
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="North America", msymbol(circle) msize(medium) mcolor(red))//
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="South Asia", msymbol(circle) msize(medium) mcolor(yellow))//
    (lfit TaxRevenueasaofGDP LnGDPpercapita)
    ytitle("Tax Revenue as a percent GDP") ///
    xtitle("Ln GDP per capita") leg(lab(1 "Burkina Faso") lab(2 "Sub-Saharan Africa") size(vsmall) c(3) pos(6)) graphregion(fcolor(white))


    Many thanks in advance.


  • #2
    Add a space + "///" for a line break. Run the code in a do file.



    Code:
    twoway (scatter TaxRevenueasaofGDP LnGDPpercapita if Country=="Burkina Faso", msymbol(diamond) msize(large) ///
    mcolor(lightblue) mlabel(Country) mlabs(vsmall) mlabc(lavender))(scatter TaxRevenueasaofGDP LnGDPpercapita if ///
    Region=="Sub-Saharan Africa" & Country!="Burkina Faso", mlabel(Code) msymbol(circle) msize(medium) mcolor(pink)) ///
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region!="Sub-Saharan Africa", msymbol(circle) msize(medium) mcolor(green)) ///
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="Latin America & Caribbean", msymbol(circle) msize(medium) mcolor(blue)) ///
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="Middle East & North Africa", msymbol(circle) msize(medium) mcolor(orange)) ///
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="North America", msymbol(circle) msize(medium) mcolor(red)) ///
    (scatter TaxRevenueasaofGDP LnGDPpercapita if Region=="South Asia", msymbol(circle) msize(medium) mcolor(yellow))
    (lfit TaxRevenueasaofGDP LnGDPpercapita) ytitle("Tax Revenue as a percent GDP") xtitle("Ln GDP per capita") ///
    leg(lab(1 "Burkina Faso") lab(2 "Sub-Saharan Africa") size(vsmall) c(3) pos(6)) graphregion(fcolor(white))

    Comment


    • #3
      Thank you so much Andrew Musau. It works!!!!!! Much appreciated your advice.

      Comment

      Working...
      X