Announcement

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

  • Restrict range of y axis

    I am plotting data whose y values range from -14.9 to +14.9. Yet the range of the y axis is (-20 20), even when I try to restrict it to (-15 15). Why? How can I restrict it to (-15 15)?

    Code:
    clear
    set obs 21
    gen i = _n
    gen est = _n - 11
    gen upper = est + 4.9
    gen lower = est - 4.9
    
    twoway rcap upper lower i || scatter est i, yscale(range(-15 15))

  • #2
    The default ticks will also extend the y-axis as needed. You will need to customize the tick labels to help with restriction.

    Code:
    twoway rcap upper lower i || scatter est i, yscale(range(-15 15)) yla(-15 15)

    Comment

    Working...
    X