Announcement

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

  • Rotate one legend symbol in twoway plot?

    In the following plot,

    Code:
    sysuse auto, clear
    
    twoway (lfit price weight) ///
        (scatteri 0 2500 10000 2500, recast(line))
    Is there a way to rotate, in the legend, the line/symbol of "y" only so that it looks like a vertical line and not a horizontal line? (Current and desired output below). I can't find something like ", angle(X)".

    Attached Files
    Last edited by Manuel PenaH; 19 Jul 2023, 10:45.

  • #2
    Manuel PenaH , here is one way:
    Code:
    twoway lfit price weight, lc(blue)  /// 
        || scatteri 0 2500 10000 2500, recast(line)  lc(red)  /// 
        || scatteri 0 2500 , msymbol(|)  msize(*3) mcolor(red) || , ///  
        legend(pos(6) row(1) order(1 "Fitted Values" 3 "y"))

    Comment


    • #3
      Works like a charm! Very smart solution. Thank you so much, Scott!

      Comment

      Working...
      X