Announcement

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

  • Scatterplot CountryName display only certain values

    I want to only show Somalia, Afghanistan, Chad, and some outlier CountryNames.

    twoway (scatter fertrate employtopop if Time==2009, mlabel(CountryName) mlabsize(relative1p5)), title(Scatterplot of Employment to Population Ratio and Fertility Rate) caption(Data: World Bank Databank)
    Above is the code I used.

    Below is the graph.
    Click image for larger version

Name:	2009 Countries Fertility Rate and Emp to Pop Ratio PNG.png
Views:	1
Size:	77.4 KB
ID:	1751702


    I want the graph to show only some CountryNames that are outliers. How can I edit the code?

  • #2
    Generate an indicator for these countries and then create two scatterplots, suppressing the markers in the subsample but displaying the marker labels. You may consider labeling the markers with three letter country ISO codes instead of their names.

    Code:
    sysuse census, clear
    *CREATE INDICATOR E.G., 
    gen sample= marriage>85000
    scatter pop marriage, xsc(r(0 275000)) || ///
    scatter pop marriage if sample, msy(none) ///
    mlab(state2) mlabc(black) leg(off) xlab(0 (50000)250000)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	37.1 KB
ID:	1751714

    Comment

    Working...
    X