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

st: Text in by() graphs


From   Friedrich Huebler <[email protected]>
To   [email protected]
Subject   st: Text in by() graphs
Date   Wed, 14 Jan 2004 08:13:16 -0800 (PST)

Is it possible to add different text to the individual plots in a
by() graph? In a response to a question by Joseph Wagner I posted
these commands two days ago:

. sysuse auto
. count if mpg<. & weight<. & foreign==1
. local for = string(r(N), "%2.0f")
. count if mpg<. & weight<. & foreign==0
. local dom = string(r(N), "%2.0f")
. scatter mpg weight, by(foreign) text(40 1000 "N = `for'") text(40
4000 "N = `dom'")

"N = 52" indicates the number of domestic cars and "N = 22" the
number of foreign cars. The text should appear in the appropriate
plots but with the -scatter- command above each of the sample sizes
is shown twice in the graph. I could not find a solution in the Stata
graphics manual. Options -xaxis()- and -yaxis()-, which looked
promising, apparently do not apply to -by()- graphs.

. scatter mpg weight, by(foreign) text(40 1000 "N = `for'", xaxis(2))
text(40 4000 "N = `dom'", xaxis(1))
text() option invalid, specified axis pair (1 2) not in graph
invalid syntax
invalid syntax
invalid syntax
r(198);

Thank you for your help.

Friedrich Huebler

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
*
*   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