Statalist The Stata Listserver


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

Re: st: Graph overlay order


From   Nick Winter <[email protected]>
To   [email protected]
Subject   Re: st: Graph overlay order
Date   Tue, 14 Feb 2006 11:54:42 -0500

I think this has come up before, and I think I recall that the answer is that (x|y)line() is always behind the data.

But you can use -twoway function- with the horizontal option to put a line on top. For example (using the auto dataset):

. graph twoway histogram mpg , freq || function y=21.2973 , range(0 25) horizontal

You can also get more control over lines (e.g., not horizonal and vertical), with -pci- and -pcarrowi-, eg:

. graph twoway histogram mpg , freq || pcarrowi 20 21.2973 13 21.2973 "Mean", mlabpos(12)

(Though I think these are version 9 additions.)

--Nick Winter




to use At 10:43 AM 2/14/2006, you wrote:

I'm still using STATA 8.2.

I have plotted a histogram with a normal curve centered at the mean and scaled to the standard deviation using:

graph twoway histogram Wgt if Lot == 9,freq width(25) xline(575) ||function SD = normden((x - 575)/49)*30, range(420 750) xscale(range(350 900)) xlabel(400(100)800) title("Lot 9 Histogram, Mean, Standard Deviation")

The 'xline(575) produces a line from the x axis that is just the way I want it to look, except it is behind the histogram rather than in front of it.

I've tried placing the 'xline' option in the histogram statement and in the function statement but in either case the line is plotted behind the histogram.

Is it possible to control the overlay order of added lines? I've looked for control of overlay orders for lines in added_line_options, addedlinestyle, lines and linestyle. Have I missed it in there somewhere? I'll be grateful for any advice.

Thanks,

Brad

Bradley D. De Groot, D.V.M., Ph.D.
Veterinary Epidemiologist
KSU-CVM-DMP-FAHMC
Mosier I-102
1800 Denison Ave.
Manhattan KS 66506
(O) 785 532 4845
(F) 785 532 4288
[email protected]


*
* 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/
________________________________________________________
Nicholas J. G. Winter 607.255.8819 t
Assistant Professor 607.255.4530 f
Department of Government [email protected] e
Cornell University falcon.arts.cornell.edu/nw53 w
308 White Hall
Ithaca, NY 14853-4601

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