Announcement

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

  • Title for categorical axis

    Posting this because it's taken a few hours for the penny to drop, and maybe it will help someone or could be put in documentation. I made a box plot over(month) which looks fine except the "x" axis is labelled 1,2,3,...12 and doesn't say what the values are. Option xti() gives an error message "there isn't an x axis" and I didn't find a suggestion in help, pdf manuals or the Forum. Finally twigged that b1(Month) did what I wanted. Maybe I'm just losing my mind ...

  • #2
    I agree with R Allan Reese that this should be documented (and isn't so far as I can see).

    Allan is assuming use of graph box. If you're using graph hbox, it's a different title.

    Code:
    . sysuse auto, clear
    (1978 automobile data)
    
    . graph box mpg, over(rep78)
    
    . graph box mpg, over(rep78) b1title(Repair record 1978)
    
    . graph hbox mpg, over(rep78) l1title(Repair record 1978)
    Further, community-contributed commands that produce box plots are likely to be using twoway, in which case xtitle() is always available.

    Comment


    • #3
      If you attach a value label to the month variable, -graph box y, over(month)- will use the value labels on the horizontal axis without any additional work required.

      Added: Crossed with #2. And I now realize that my response is off-point. O.P. was interested in providing a title for the axis, not for getting the months themselves displayed as month names. Then again, maybe if the months were display as month names, the title would be redundant.

      Comment


      • #4
        In many people's past was a teacher, often in physics, who was scathing if you didn't label your axes properly.

        That teacher was right, except that -- as in Clyde Schechter's #3 -- axis labels such as "January" or "2024" surely don't need an explicit axis title too.

        Comment

        Working...
        X