Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Labeling series within the plot area


From   "Allan Reese (Cefas)" <allan.reese@cefas.co.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Labeling series within the plot area
Date   Fri, 30 Nov 2012 09:38:58 -0000

A trick I use is to create a second variable containing the label but
only at the selected points - usually the maximum.

use auto
regress price wei i.for#c.wei
predict yhat
egen maxpoint=max(yhat), by(for)
sort for yhat
g flab="US"
replace flab="Foreign" if for==1
replace flab="" if yhat!=maxpoint
scatter price yhat weight, ms(oh i) c(. L) mlab(. flab)

You can use mlabpos and xscale(range()) to allow for fit, or just use
the graph editor to tweak position.

Allan

On Nov 29, 2012, at 12:28 PM, Max.Livingston@ny.frb.org wrote:
>> When creating graphs (using a do-file, not the Graph Editor), is
there a
>> way to label the data series in the plot area, so the name of the
series
>> would appear near the line that is plotted? Here is an example:
>>
http://libertystreeteconomics.typepad.com/.a/6a01348793456c970c017d3dfcd
f73970c-popup


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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