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

Re: st: labels in two-way line graphs


From   "R. Allan Reese" <[email protected]>
To   Stata distribution list <[email protected]>
Subject   Re: st: labels in two-way line graphs
Date   Fri, 16 May 2003 16:59:41 +0100 (BST)

One way is to attach a label to the last point of the line. Create a
string variable with a value opposite the point you want labelled.  In
Stata 7 and below, this was plotted as an extra series; in Stata 8 it is
the mlabel option, with extra control on the placement etc.

Eg:

scatter  y x, c(l)                         draws line graph

/* If points are sorted */
gen str8 name = "Series 1" if _n==_N                 label

/* If points not sorted, in which case beware connect! */
egen m=max(x)
gen str8 name = "Series 1" if x=m         or could label at max(y)

/* Or you can just type the label on a row in the data editor! */

scatter  y x, c(l) mlabel(name)

-------------------------------
The Graphics book does not suggest multiple lines with separate labels,
but I just tested this example which worked as desired:

scatter y1 y2 x , c(l l) mlabel(n1 n2) mlabpos(2 9)


R. Allan Reese                       Email: [email protected]


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