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

st: Linking legend text to the value of a variable

From   Dorothy Bridges <>
Subject   st: Linking legend text to the value of a variable
Date   Thu, 1 Oct 2009 08:51:28 -0400

Dear Statalist:

I have a loop creating twoway graphs along the lines of the following:

levels idvar, local(ID)
foreach i of local ID{
di "`i'";
twoway (line yvar xvar if idvar=="`i'" & idvar2==1 & idvar3==1, lpattern(dash))
(line yvar xvar if idvar=="`i'" & idvar2==2 & idvar3==1, lpattern(dash))
(line yvar2 xvar2 if idvar=="`i'" & idvar2==1 & idvar3==1, color(navy)
yaxis(2) lpattern(dash))

And I would like the legend to be: legend(label(1 =idvar2_name if
idvar=="`i'" & idvar2==1 & idvar3==1) label(2 =idvar2_name if
idvar=="`i'" & idvar2==2 & idvar3==1))

How might I accomplish this?  I found this
( in the
archive but couldn't quite get from there to where I would like to be.

Thank you!
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index