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

RE: st: RE: Problems with graphing in Stata 8


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Problems with graphing in Stata 8
Date   Mon, 23 Feb 2004 18:16:49 -0000

You don't have to do it this way. As said, 
you can approach it from the direction you 
started from. Something like 

twoway (scatter HbL HbH if sex==1, ms(Oh)) (scatter HbL HbH if
sex==2, ms(D) legend(order(1 "male" 2 "female")))  

should work. The difference is between overlaying two 
graphs and drawing one. When it is more like a matter 
of overlaying five or six graphs, the issue takes
on a different shape. 

By the way, what you're puzzled by is not a graphical 
issue. If you 

. list HbL HbH if sex == 1 

the condition "if sex == 1" is left on the command 
line and not echoed in the output in any direct way, 
although it does affect the results you get. 

Nick 
[email protected] 

Donald Spady
> 
> It works.  Seems a rather roundabout way to do this, having 
> to create new 
> variables, but it works.
> Many thanks

> >Some recent threads have touched on this
> >question.
> >
> > >From Stata's point of view both graphs are
> >graphs of -HbL- versus -HbH-. -sex- is merely
> >the criterion you used to select points and
> >it doesn't feature in the graph. Why should
> >it? Both -if- conditions are upstream filters
> >determining what gets passed to the graph-drawing
> >commands.
> >
> >What you did can be tweaked to get what you
> >want, but for similar problems I favour this
> >kind of approach (and indeed -separate- was
> >written largely for this purpose):
> >
> >separate HbL, by(sex)
> >scatter HbL? HbH , legend(order(1 "male" 2 "female"))
> >
> >Nick
> >[email protected]
> >
> >Donald Spady
> > >
> > > when I plot twoway (scatter HbL HbH if sex==1) (scatter HbL HbH if
> > > sex==2)  I expect to get an overlaid plot with corresponding
> > > HbL & HbH
> > > having one symbol if sex==1 and another symbol if sex == 2.  I get
> > > different symbols, but in the legend box I get a blue diamond
> > > signifying
> > > HbL and a brown diamond signifying HbL.  That's right, both
> > > signify HbL
> > > and neither one signifies sex, which I expected.  What is
> > > going on?  What
> > > am I doing (or interpreting) wrong?

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