Announcement

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

  • changing axis range

    I'm creating a variety of graphs, and no matter the data being plotted on a given graph, all the graphs need the same y axis, the same range, and the same labels. I will calculate the correct range myself, and part of that decision is a substantive consideration. Therefore, I need control over the range of the y axis. That is, I need to have true control over the range, not approximate suggestions that Stata might consider if it feels like it.

    After spending a lot of time in the manuals and trying various things, I've narrowed down the problem to range within yscale. I've recreated the problem with the auto dataset:
    Code:
    sysuse auto.dta
    scatter price mpg, yscale(range(0 7000 14000 21000 28000 35000 42000 49000 ))
    As shown below, this creates a chart with only three labels on the Y axis (0, 5000, 10000, and 15000). The Y axis looks like it probably does go to 49000, but obviously the Y labels aren't what I asked for, and the grid isn't either. Is there a way to force Stata to create a Y axis that actually uses the y labels that I specified?

    Attached Files

  • #2
    Use ylabel():
    Code:
    scatter price mpg , ylabel(0 7000 14000 21000 28000 35000 42000 49000 )
    Click image for larger version

Name:	gr.png
Views:	1
Size:	20.5 KB
ID:	1532406

    Comment


    • #3
      Excellent. Thanks Scott!

      Comment

      Working...
      X