----- Original Message -----
From: "Friedrich Huebler" <[email protected]>
To: <[email protected]>
Sent: Wednesday, April 09, 2003 12:43 PM
Subject: st: How to suppress legend keys
> How can I suppress legend keys for variables without data? Let me
> illustrate this with a meaningless example from the auto data.
>
> . sysuse auto
> . scatter headroom rep78 mpg
>
> The scatterplot has a legend with two keys, "Headroom (in.)" and
> "Repair Record 1978". Now I replace all values for headroom with
> missing values and draw the scatterplot again.
>
> . replace headroom=.
> . scatter headroom rep78 mpg
>
> The legend still has two keys although only the repair record appears
> in the graph.
>
> Is it possible to instruct Stata to only show keys for data that
> appears in the graph? I am thinking of something like "show legend
> for headroom if headroom is not missing and show legend for rep78 if
> rep78 is not missing".
>
> Thank you,
>
> Friedrich Huebler
>
This will only show the legend for only the second variable:
twoway (scatter h r mp), legend(order(2 "Repair 1978"))
Scott
*
* 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/