Statalist


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

st: RE : RE: RE: Add variable value on a graph


From   alvine.bissery@chu-lyon.fr
To   statalist@hsphsun2.harvard.edu
Subject   st: RE : RE: RE: Add variable value on a graph
Date   Thu, 28 Aug 2008 09:57:26 +0200

Thank you Nick.
Your suggestion 

foreach ID of local IDS { 
	su BMI if id == `ID', meanonly  
	line hem time, t1title(`r(min)') 
}

seems the only one which allows to display a changing value for each subject.

Alvine

-----Message d'origine-----
De : owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] De la part de Nick Cox
Envoyé : 27 August 2008 15:58
À : statalist@hsphsun2.harvard.edu
Objet : st: RE: RE: Add variable value on a graph


The persuasion Martin suggests is unnecessary. You can add text to a
-line- graph using 
-text()-. Or you can put the same text in a title or the legend. 

Here is a dopey example. 

. sysuse auto

. sort weight mpg

. line weight mpg, text(3000 25 "some text")

If Alvine's problem were mine, I'd probably use -t1title()-. This is best
done as a loop, e.g. 

levelsof id, local(IDS)

foreach ID of local IDS { 
	su BMI if id == `ID', meanonly  
	line hem time, t1title(`r(min)') 
} 

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss

If you could be persuaded to use a -scatter- instead of -line-, then -help
scatter##marker_options- shows that you can add the value of a variable of
your choice to the marker symbols...

alvine.bissery@chu-lyon.fr

I would like to create a graph with  repeated values of hemoglobin versus
time (0,1,2,6 and 12 months) for each subject of my data .

 gr twoway (line hem time) if id==1

I have a variable "BMI" in my data base which gives the BMI of each subject.
I would like to add the value of BMI on each graph for each subject (as
legend) .
Is it possible to add on a plot the value of a variable ?

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


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



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