I am working with a simple panel dataset of 40 individuals' characteristics over 2000 to 2010.
I am creating a simple scatter graph of an x-variable (x1) and year (year) by individual-ID (indid) using the code below.
The graph works just fine and all the aspects of the graph looks correct, EXCEPT that the x-axis labels only appear for the last 7 individuals.
I can manually add in the x-axis for the 33 other individuals using graph editor, right clicking on the x-axis and choosing the "Show" option.
Is there a way to directly instruct STATA to show all the x-axis values for all 40 individuals?
I am enclosing the STATA code and data below.
Thanks!
SAM
Code:
scatter x1 year, by(indid) /// yscale(range(0 50)) /// xscale(range(2000 2010)) /// ytitle("Y-Axis", placement (nw)) /// xtitle("Year") /// xlabel(2000(2)2010, valuelabel grid) /// ylabel(0(10)50)
The data is below:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte indid int year float x1 1 2000 20 1 2001 23.1 1 2002 24.9 1 2003 25 1 2004 25.6 1 2005 25.6 1 2006 25.8 1 2007 25.9 1 2008 26 1 2009 26.1 1 2010 26.4 2 2000 26.4 2 2001 26.4 2 2002 26.6 2 2003 26.8 2 2004 27 2 2005 27 2 2006 27.8 2 2007 28 2 2008 28 2 2009 28.4 2 2010 28.6 3 2000 28.8 3 2001 28.9 3 2002 29 3 2003 29.4 3 2004 29.7 3 2005 29.9 3 2006 30 3 2007 30 3 2008 30 3 2009 30.7 3 2010 30.8 4 2000 31 4 2001 31 4 2002 31 4 2003 31.3 4 2004 31.9 4 2005 32.1 4 2006 32.2 4 2007 32.4 4 2008 32.4 4 2009 32.8 4 2010 33 5 2000 33.2 5 2001 33.5 5 2002 33.6 5 2003 33.9 5 2004 33.9 5 2005 34 5 2006 34 5 2007 34 5 2008 34 5 2009 34.1 5 2010 34.3 6 2000 34.3 6 2001 34.3 6 2002 34.4 6 2003 34.5 6 2004 34.5 6 2005 34.6 6 2006 34.7 6 2007 34.7 6 2008 34.7 6 2009 34.8 6 2010 34.8 7 2000 34.9 7 2001 35 7 2002 35 7 2003 35 7 2004 35 7 2005 35 7 2006 35 7 2007 35 7 2008 35 7 2009 35 7 2010 35.4 8 2000 35.4 8 2001 35.4 8 2002 35.5 8 2003 35.6 8 2004 35.7 8 2005 35.7 8 2006 35.9 8 2007 36 8 2008 36 8 2009 36 8 2010 36 9 2000 36.1 9 2001 36.1 9 2002 36.1 9 2003 36.2 9 2004 36.3 9 2005 36.4 9 2006 36.4 9 2007 36.4 9 2008 36.6 9 2009 36.8 9 2010 36.8 10 2000 36.8 end
Thanks.
SAM
0 Response to Missing Axis Labels only for some Graphs
Post a Comment