Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: legend on graph help


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: legend on graph help
Date   Mon, 13 Mar 2006 08:47:24 -0600

What is the error that is reported?

A couple of things stand out:

1. You have no -legend()- around the -order()- suboption.

2.  It doesn't appear that the -legend(order())- (or the ytitle, yscale....)
are attached to one of the -line- commands.

Is this what you want:

sysuse auto,clear

twoway line mpg price if fore == 0 ,sort lc(blue) lp(dash) /// 
|| line mpg price if fore == 1 , sort lc(black)  ///
legend(order(1 "white sex ratio" 2 "black sex ratio"))

Scott


> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Scott Cunningham
> Sent: Monday, March 13, 2006 8:31 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: legend on graph help
> 
> I am having trouble adjusting the legend of a simple table.  It's a
> two-way graph and I have one variable (SexRatio) which I'm plotting
> separately for Blacks and Whites.  The variable has no descriptive
> labeling, so I wanted to change the legend by using the legend-
> ordering command.  Is there an obvious mistake here that someone can
> immediately point out?  Thanks. -sc
> 
> . twoway (order (1 "white sex ratio", 2 "black sex ratio")) (line
> SexRatio age if race==1, lcolor(black) lpattern(dash)) (line SexRatio
> age if race==2, lcolor(black) lpattern(solid)), ytitle(Ratio of Males
> to Females) yscale(range(.65 1.1)) xtitle(Age Cohort) xscale(range(0
> 30)) title(Cohort-Specific U.S. Sex Ratios) caption(All ages are 5-
> year cohorts)



*
*   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–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index