Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: How to suppress legend keys


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Re: How to suppress legend keys
Date   Thu, 10 Apr 2003 11:16:25 -0700 (PDT)

Nick,

Thank you very much, with your help I could get the graphs that I
needed. You provided two solutions, both of which worked. I adopted
the longer alternative because it allows me to plot the individual
time series with different markers and colors. I don't know how this
can be done with the shorter alternative that you provided.

Because I have eight time series I shortened your first suggestion by
adding a counter i. Below is the end result, reduced to four
variables and minus -title-, -scale- and other options.

foreach x of local countries {;
  local i 0;
  foreach v of varlist var_a var_b var_c var_d {;
    local i = `i' + 1;
    quietly count if `v'<. & country=="`x'";
    if r(N)>0 {;
      local leg`i' `i';
    };
    else {;
      local leg`i' ;
    };
  };

  scatter var_a year if country=="`x'", pstyle(p1) || 
    scatter var_b year if country=="`x'", pstyle(p1) ||
    scatter var_c year if country=="`x'", pstyle(p2) || 
    scatter var_d year if country=="`x'", pstyle(p2)
    legend(order(`leg1' `leg2' `leg3' `leg4'));
  graph export "`x'.wmf";
  };

Friedrich Huebler

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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