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: Unnecessary Labels for Graphs
From
Matthew Mulligan <[email protected]>
To
[email protected]
Subject
st: Unnecessary Labels for Graphs
Date
Wed, 18 Jul 2012 15:19:24 -0400
Dear Statalist
I have to make a series of line graphs that I am hoping to use in a
loop. Howver, for certains variables of varlist prov_cov_`x' does not
equal one, and therefore the line does not show up on the graph. This
was intentional as I am hoping only graph certain lines for certain
variables. The problem is that there is still a label for that line,
taken from the previous existing line. Without completely removing
the legend, is there a way of forcing the label for the line that does
not exist to not show up. I would appreciate your help. Code below:
foreach x of local varlist {
graph twoway ///
( line cov_`x' date if prov==2 & prov_cov_`x'==1, lwidth(thick)
yvarlabel("Prov1")) ///
( line cov_`x' date if prov==5 & prov_cov_`x'==1, lwidth(thick)
yvarlabel("Prov2")) ///
( line cov_`x' date if prov==8 & prov_cov_`x'==1, lwidth(thick)
yvarlabel("Prov3")) ///
( line cov_`x' date if prov==9 & prov_cov_`x'==1, lwidth(thick)
yvarlabel("Prov4")) ///
( line cov_`x' date if prov==11 & prov_cov_`x'==1, lwidth(thick)
yvarlabel("Prov5"))
}
Matt
Research Assistant
World Bank
*
* 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/