Creating a second row of axis label

In this post, I will show you how to create a second row of axis label. Below is a worked example. We can see that the first row of the label shows years from 1990 to 1999, the second row further shows four seasons within each year. This allows us to visualise the sales performance clearly. This function is very useful for analysing the trend for a variable, especially in a time series data:

The commands I used in a do-file are:

webuse turksales, clear
line sales t,                              ///
xtick(119.5(4)159.5, tlength(*1.5))    ///
xmlabel(120/159,                       ///
noticks format(%tqq))              ///
xlabel(121.5(4)157.5,                  ///
noticks format(%tqCY) labgap(2.5)) ///
xtitle("")

You may find the book A Visual Guide to Stata Graphics, 3rd Edition very useful for producing graphs in Stata.

6 views

© 2020 by Survey Design and Analysis Services. 

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube