--- On Sat, 19/12/09, Robert Duval wrote:
> I have a graph with several vertical reference lines (i.e.
> xline(#1 #2 etc)) each with different line pattern styles.
> Is there a way to create a legend to indicate what each
> reference line means ?
Here is one possible solution. -scatteri- and everything
following is there to create a second x-axis at the top of
the graph, which contains labels for the different
reference lines. I think this way it is easier for the
reader to decode which label belongs to which reference
line.
*------------- begin example ----------------
sysuse auto, clear
twoway kdensity mpg , ///
xline(16.1,lp(solid)) ///
xline(22.22,lp(dash)) ///
xline(28.33,lp(shortdash)) || ///
scatteri 0 20, msymbol(i) xaxis(2) ///
xtitle("",axis(2)) ///
xscale(range(10 41) axis(2)) ///
legend(off) ///
xlab(16.1 "foo" 22.22 "bar" ///
28.33 "blup", axis(2))
*--------------- end example ----------------
( For more on how to use examples I sent to statalist see:
http://www.maartenbuis.nl/stata/exampleFAQ.html )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* 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/