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

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

From   "Nick Cox" <>
To   <>
Subject   st: RE: AW: how to have legend as labels on graph
Date   Fri, 14 Aug 2009 19:07:49 +0100

Here's a different approach. I think this is closer to what was asked
Note that we can't comment on what was wrong about your code if you
don't show us any! 

webuse lutkepohl2

line ln* qtr, ///
text(`=ln_inv[_N]' `=qtr[_N] + 1' "investment", place(e)) ///
text(`=ln_inc[_N]' `=qtr[_N] + 1' "income", place(e))  ///
text(`=ln_cons[_N]' `=qtr[_N] + 1' "consumption", place(e)) ///
xsc(r(0,108)) ///
legend(off)  /// 
ytitle(log of unstated units)

Bottom line: use -text()- and -legend(off)-. 


Martin Weiss

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...

Gisella Young

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
which is which. What I want is to have the labels on the chart itself,
to each line (e.g. on the right hand side), i.e. next to each line to
the name of the province which it's for. I've tried and tried but am
unable to do this, is it possible???

*   For searches and help try:

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