Announcement

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

  • Legend for graphs with marker symbol invisible

    Hello,

    I am graphing a twoway dot, with two variables.

    I can´t seem to find a way to add a legend (it will display with no color) to the graph when the marker symbol is invisible and the marker label is the value of the variables, since there is no actual marker symbol to display, but the marker labels do have different colors for each variable.

    I would appreciate some help with this,
    Thank you

  • #2
    I don't think there's a way to specify different colors for different legend entries. A workaround to your problem would be not to display the legend and use the text option, instead. An example:
    Code:
    sysuse auto, clear
    
    keep if _n<10 //I keep just a few observations to draw the graph
    
    twoway (scatter price mpg, ms(none) mlabel(price)) ///
        (scatter weight mpg, ms(none) mlabel(weight)), ///
        legend(off) text(10000 24 "Price", color(navy) place(3)) ///
        text(9500 24 "Weight", color(maroon) place(3))

    Comment

    Working...
    X