Announcement

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

  • Tsline x-axis format

    Hi,

    I have monthly time series data and would like to produce a line graph. I have tsset (monthly) the data.

    However, I would only like the year to show along the x-axis, i.e 2010,2011,...,2016 as opposed to the year and month, i.e., 2010m1, 2011m1,...,2016m1.

    I've managed to specify the labels I would like with the following code, but the output includes the monthly suffix:

    tsline x, tlabel(2010m1 2011m1 2012m1 2013m1 2014m1 2015m1 2016m1)

    PS: I would like to do this with code as opposed to the graph editor.

    Thanks in advance!

  • #2
    With that small a time range, you should think of labelling intervals not points. See

    http://www.stata-journal.com/sjpdf.h...iclenum=gr0030

    with a trivial difference that that example deals with quarterly data, not monthly. Either way, using an explicit format such as %tmCY is the way forward. That says, I know I have monthly dates but I want to see just (century and) year.

    Note that the help for tsline has an example explaining the use of a format to specify display of only part of a date. The help for any command is always your first resource.

    Please note our stated preference here for full real names.

    Comment

    Working...
    X