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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

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

Date |
Fri, 14 Aug 2009 19:11:12 +0100 |

The "unstated units" are billion DM; I looked in the variable labels, but they are explicit in the data label. Not material to the main point, but my mistake nevertheless. Nick n.j.cox@durham.ac.uk -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: 14 August 2009 19:08 To: statalist@hsphsun2.harvard.edu Subject: st: RE: AW: how to have legend as labels on graph Here's a different approach. I think this is closer to what was asked for. 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)-. Nick n.j.cox@durham.ac.uk Martin Weiss ************* 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... 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 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??? * * 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/

**Follow-Ups**:**st: RE: RE: RE: AW: how to have legend as labels on graph***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**References**:**st: how to have legend as labels on graph***From:*Gisella Young <gisellayoung@yahoo.com>

**st: AW: how to have legend as labels on graph***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**st: RE: AW: how to have legend as labels on graph***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**Re: st: AW: numeric format** - Next by Date:
**st: RE: RE: AW: how to have legend as labels on graph** - Previous by thread:
**st: RE: AW: how to have legend as labels on graph** - Next by thread:
**st: RE: RE: RE: AW: how to have legend as labels on graph** - Index(es):

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