Announcement

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

  • Force tsline y-range

    Dear All,
    suppose you plot:
    Code:
    set seed = 04052017
    set obs 200
    gen time = _n
    gen y = rnormal()
    tsset time
    tsline y
    I want to limit the range of the y axis, say from -2.5 to 2.5 (basically get rid off the empty white space above). I read in a Stata tip edition, to use yscale and ylabel simultaneously.

    Code:
    tsline y, yscale(range(0 4)) ylabel(0(1)4)
    But I cannot seem to get what I want. I realize that this could cut off some data points and that this is undesirable. In the true data it would only make an effect better visible. Can anyone point me to how this can be done?

    Thanks in advance,

    Best,






  • #2
    I don't follow how your code could do what you want. If the observed range is rather more than [-2, 2] all that code will do is add more space (and some labels) at the top.

    Comment


    • #3
      yeah the code was trying to cut off at zero, it should have been:
      Code:
       
       tsline y, yscale(range(-2.5 2.5)) ylabel(-2(1)2)

      but that does not work either. Is there a way to do it? sounds like a straight forward task.

      Comment

      Working...
      X