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]

Re: st: xtline and addplot option


From   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: xtline and addplot option
Date   Wed, 29 Jun 2011 10:04:20 +0200

That seems to be a quirk in how the -by()- option works (the -by()-
option is implicit in -xtline-). You can work around that by creating
separate id variables for each graph that contains missing values for
all groups you want to exclude from your graph. -clonevar- is probably
convenient when you attached value labels to your id's and/or when you
do not use the default storage type for your id variable.

Hope this helps,
Maarten

On Tue, Jun 28, 2011 at 9:18 PM, Lindsay Pettingill <[email protected]> wrote:
> 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/
>



-- 
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------

*
*   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