Announcement

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

  • Labeling question

    Dear all,

    Back with another basic question regarding the labeling of graphs.
    I want to plot the savings rate over time (and for different countries), more specifically over the period 2001-2014. Due to this specific timeframe, I cannot use the standard
    Code:
    xlabel(2001([preferred range])2014)
    I have tried using minor ticks, which does show 'ticks' for intermediate years, but no labels. More specifically, I would like to see labels for 2001, 2005, 2009 and 2014.
    The current code I have is
    Code:
    line savings_rate year, by(country,xrescale) xtitle("") ytitle("") title("") xlab(minmax) xmticks(#3)
    What do I need to change?

    Thanks,

    W.


  • #2
    Code:
    xla(2001 2005 2009 2014)
    should be enough.

    Specifying the precise label positions you want used to be, and still is, the easiest non-default rule to understand and use. Looking at the help for axis label options I find that this doesn't spring out as clearly as it should.

    While you're at it please zap the default xtitle "year" if it is what you got. Stata is not to blame because it doesn't know about the semantics of a graph, but if I see an x axis with 2001 2005 2009 2014 I really don't need the extra information that those numbers are the years. Your secondary school teachers presumably told you always to label your axes, but they were not always right.

    Comment


    • #3
      Originally posted by Nick Cox View Post
      Code:
      xla(2001 2005 2009 2014)
      should be enough.

      Specifying the precise label positions you want used to be, and still is, the easiest non-default rule to understand and use. Looking at the help for axis label options I find that this doesn't spring out as clearly as it should.

      While you're at it please zap the default xtitle "year" if it is what you got. Stata is not to blame because it doesn't know about the semantics of a graph, but if I see an x axis with 2001 2005 2009 2014 I really don't need the extra information that those numbers are the years. Your secondary school teachers presumably told you always to label your axes, but they were not always right.
      Thanks. That indeed did the trick! I looked extensively at the axis label options and as you mention, it was not clear from there that this option is the easiest way to tackle this 'issue'.
      With regards to your comment on xtitle: I use
      Code:
      xtitle("")
      , so it does not show any title, both for the x-axis and y-axis.. Or did I interpret your comment wrongly?

      Comment


      • #4
        Everything correct on your side.

        The fault is all mine for not looking at your code carefully enough to see that you were doing exactly as I recommended.

        Pavlov got his dogs to salivate if he rang a bell. If you talk about a time axis, you'll liable to get a miniature rant from me about the axis title -- and you're doing the right thing any way.
        Last edited by Nick Cox; 23 Aug 2018, 07:39.

        Comment

        Working...
        X