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]
Re: st: xtline and addplot option
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: xtline and addplot option
Date
Wed, 29 Jun 2011 08:24:17 +0100
I'd try doing this
preserve
keep if newids < 6
xtline xvar, t(year) i(city_state) addplot(line xvar2 year)
restore
Nick
On Tue, Jun 28, 2011 at 8:18 PM, Lindsay Pettingill <[email protected]> wrote:
> 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?
*
* 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/