Statalist


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

st: AW: how to have legend as labels on graph


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: how to have legend as labels on graph
Date   Fri, 14 Aug 2009 17:33:48 +0200

<> 


*************
clear*
set obs 100

gen x1= rnormal() 
la var x1 "Arizona"
gen x2= rnormal() +20
la var x2 "New Mexico"
gen x3=rnormal() -20
la var x3 "Texas"

gen time=_n

tw (line x1 time) (line x2 time) (line x3 time), /* 
 */ ylabel(`=x1[1]' "`:var la x1'" `=x2[1]' /* 
 */ "`:var la x2'"  `=x3[1]' "`:var la x3'", /* 
 */ angle(forty_five)) legend(off)

*************

You could automate the production of the -tw- code via a loop, as often
advertised on the list...

HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Gisella Young
Gesendet: Freitag, 14. August 2009 17:26
An: [email protected]
Betreff: st: how to have legend as labels on graph

A simple question. I have a simple line graph with multiple lines on it (one
line for each province, showing a single variable over time for each).
Having a legend is confusing as the chart will be in B&W and there are a
number of lines so, even with different line styles, it is difficult to see
which is which. What I want is to have the labels on the chart itself, next
to each line (e.g. on the right hand side), i.e. next to each line to have
the name of the province which it's for. I've tried and tried but am unable
to do this, is it possible???

Thank you!

Gisella


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


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index