Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: xtline and addplot option


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
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 <lpetting@gmail.com> 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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index