Announcement

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

  • Labelling scatterplots with twoway command

    Hi all!

    I'd like to label each of these scatterplots accordingly.

    Code:
    twoway (scatter studentsat lnincome if department==1, msize(small) mcolor(cranberry%50)  msymbol(circle)) ///
            (scatter studentsat lnincome if department==2, msize(small) mcolor(blue%50) msymbol(circle)) ///
            (scatter studentsat lnincome if department==3, msize(small) mcolor(green%50) msymbol(circle)) ///
            (lfit studentsat lnincome) ///
            (qfit studentsat lnincome)
    When I use the "legend" command I receive an error message. ") required r(100)"
    This is the command I attached to the code above:

    Code:
     legend(label(1 "Economics") label(2 "Socialwork") label(3 "Sociology"))
    Any ideas on why I get this error message? Or maybe my whole approach of labelling with this command is erroneous...

    Cheers!


  • #2
    Hey,

    I solved it. How can I delete my post?

    Comment


    • #3
      You can’t delete it. This is explained in the FAQ Advice. https://www.statalist.org/forums/help#closure

      Comment

      Working...
      X