Greetings,
I'm running Stata 15.1 on OSX and using longitudinal data from the General Social Survey (1972-2016). Data for the variable I'm trying to graph is only available for the years 2002, 2006, 2010, and 2014. I'd like to examine the change in male and female responses across this time range. To do so, I entered the following:
This results in a line graph that looks like this:

As you can see, the x labels and plots begin towards the end of the x-axis. If possible, I'd like them to reposition them towards the beginning of it. Can anyone explain to me how to do so? Thanks in advance.
Example data:
I'm running Stata 15.1 on OSX and using longitudinal data from the General Social Survey (1972-2016). Data for the variable I'm trying to graph is only available for the years 2002, 2006, 2010, and 2014. I'd like to examine the change in male and female responses across this time range. To do so, I entered the following:
Code:
twoway (line SEXHAR_12MO_WOMEN SEXHAR_12MO_MEN year_sexhar12mo, lwidth(thick thick)), xlabel(2002 2006 2010 2014) legend(order(1 "Women" 2 "Men")) xtitle("Year") title("Last 12 Months") plotregion(fcolor(white)) graphregion(fcolor(white)) ytitle("Percent")
As you can see, the x labels and plots begin towards the end of the x-axis. If possible, I'd like them to reposition them towards the beginning of it. Can anyone explain to me how to do so? Thanks in advance.
Example data:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(SEXHAR_12MO_WOMEN SEXHAR_12MO_MEN year_sexhar12mo) .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 . .02644833 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 . .02644833 2002 .06142507 . 2002 .06142507 . 2002 .06142507 . 2002 end
Comment