[R] graphs

0 views
Skip to first unread message

Mary A. Marion

unread,
Jul 25, 2009, 7:39:26 PM7/25/09
to r-h...@r-project.org
Hello,

I am plotting two distributions and want to draw a vertical line at the
critical point 149.
How can I stop it from going further up than the norm(140,15) curve?

x<-seq(75,225,0.1)
plot(x,dnorm(x,mean=140, sd=15), type='l', col='navy')
abline(v = 149, col = "black")
curve(dnorm(x,mean=150, sd=15),from=75, to=225, col='orange', add=TRUE)

Thank you.

Sincerely,
Mary A. Marion

______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

baptiste auguie

unread,
Jul 25, 2009, 4:49:49 PM7/25/09
to Mary A. Marion, r-help
Try with ?segments,

x<-seq(75,225,0.1)
plot(x,dnorm(x,mean=140, sd=15), type='l', col='navy')

#abline(v = 149, col = "black")
segments(149, 0, 149, dnorm(149,140,15))


curve(dnorm(x,mean=150, sd=15),from=75, to=225, col='orange', add=TRUE)


HTH,

baptiste

2009/7/26 Mary A. Marion <mms...@comcast.net>

--

_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
______________________________

[[alternative HTML version deleted]]

Steve Lianoglou

unread,
Jul 25, 2009, 4:51:39 PM7/25/09
to Mary A. Marion, r-h...@r-project.org
Hi Mary,

On Jul 25, 2009, at 7:39 PM, Mary A. Marion wrote:

> Hello,
>
> I am plotting two distributions and want to draw a vertical line at
> the critical point 149.
> How can I stop it from going further up than the norm(140,15) curve?
>
> x<-seq(75,225,0.1)
> plot(x,dnorm(x,mean=140, sd=15), type='l', col='navy')
> abline(v = 149, col = "black")
> curve(dnorm(x,mean=150, sd=15),from=75, to=225, col='orange',
> add=TRUE)


Check ?segments

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

Poersching

unread,
Jul 26, 2009, 1:48:48 AM7/26/09
to Mary A. Marion, r-h...@r-project.org
Mary A. Marion schrieb:
Hey,
in your case you shouldn't use the abline command. Instead try segment like:
segments(149, 0, 149, dnorm(149,mean=140, sd=15))

Regards,
Christian Porsche

signature.asc

Radha Krishna

unread,
Jul 26, 2009, 2:32:32 AM7/26/09
to Mary A. Marion, r-h...@r-project.org
Hi Mary,

One can use arrows too...

Here is the code :

x<-seq(75,225,0.1)
plot(x,dnorm(x,mean=140, sd=15), type='l', col='navy')

*arrows(149,0,149,dnorm(149,140,15),length=0)
*par(new=T)
plot(x,dnorm(x,mean=150, sd=15), type='l', col='orange',axes=F)


Regards
Radha

[[alternative HTML version deleted]]

Reply all
Reply to author
Forward
0 new messages