Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Graphing Histograms and Overlaying A Vertical Line


From   "Cohen, Elan" <cohened@upmc.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Graphing Histograms and Overlaying A Vertical Line
Date   Fri, 24 May 2013 15:00:12 +0000

Erika,

The following works fine for me:

sysuse auto
su mpg, d
hist mpg, percent xline(`r(mean)' `r(p50)')

- Elan


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Erika Kociolek
Sent: Friday, May 24, 2013 10:22
To: statalist@hsphsun2.harvard.edu
Subject: st: Graphing Histograms and Overlaying A Vertical Line

I am attempting to graph a histogram, overlaying vertical lines
showing the mean and median. I know that the xline option won't get me
what I want, so I went the twoway route. What I'm trying to figure out
is how to get the range for "function" to match what's used for twoway
histogram.

summarize height
twoway histogram height, percent || function y=`r(mean)', range(? ?)

Any thoughts?

Thanks!
Erika
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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