Announcement

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

  • Different symbols for markers in scatterplot

    Hello dear Stata-Pros!

    I need to create a scatterplot with markers differing optically. One spot should present one industry, to make it look like this:




    My current code is:


    twoway (scatter local_input_za local_sales_za if F1za_SectorGroup==1, msymbol(Oh)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==2, msymbol(S)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==3, msymbol(O)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==4, msymbol(d)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==5, msymbol(th)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==6, msymbol(sh)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==7, msymbol(s)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==8, msymbol(o)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==9, msymbol(x)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==10,msymbol(+)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==11,msymbol(T)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==12,msymbol(t)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==13,msymbol(Oh)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==14,msymbol(D)) ///
    (scatter local_input_za local_sales_za if F1za_SectorGroup==15,msymbol(S)), ///
    legend(label(1 Agriculture)label(2 Mining and quarrying) label(3 Manufacturing,low-tech) ///
    label(4 Manufacturing,medium-tech) label(5 Manufacturing,high-tech) label(6 Electricity) ///
    label(7 Construction) label(8 Trade) label(9 Retail trade) label(10 Hotels and Rest) ///
    label(11 Transport) label(12 Post and Telecommunication) label(13 Finanicial institutions) ///
    label(14 Real estate and IT) label(15 Public admin))


    I think this amount of work maybe unnecessary, I thought about using a loop, but how do I make sure that every industry has an own marker?
    (Doesn't need to be a specific one, just so that industries can be optically differentiated)


    Thanks a lot!

  • #2
    Code:
    separate local_input_za, veryshortlabel
    scatter local_input_za? local_input_za?? local_sales_za
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment

    Working...
    X