Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: xtline and addplot option


From   Lindsay Pettingill <[email protected]>
To   [email protected]
Subject   st: xtline and addplot option
Date   Tue, 28 Jun 2011 15:18:58 -0400

Hello,
I'd like to add an additional plot to a series of time-series graphs.
I can do this with 'addplot', but I have so many units that I'd like
to break the graph output into about 10 units at a time. In short, I'd
like to use an "if" statement to subset the data and draw graphs and
plots for these subsets (otherwise there are just way too many plots
to look at on the graph output)

here is what I have:
xtline xvar if newid<6, t(year) i(city_state)
This gives me the initial graphs I want, for the first 6 cities in my
dataset. I want to then add the additional plots via addplot:

xtline xvar if newids<6, t(year) i(city_state) addplot(line xvar2 year
if newids<6)
This gives me the graphs and addplots that I want, for the first six
cities- but it also produces (empty) plots for all additional
cities... but it seems that I cannot specify an "if" option after the
parens to limit the plotted graphs to the first 6 cities.
(ie this does not work: xtline xvar, t(year) i(city_state)
addplot(line xvar2 year) if newids<6

Is there a way to exclude those cities that I do not want on the graph
output, short of subsetting the dataset into separate files and then
plotting the graphs for each?

Thanks,
Lindsay Pettingill
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index