On Wed, Oct 7, 2009 at 1:48 PM, Petr PIKAL <petr.pi...@precheza.cz> wrote:

> Hi
>
> Rainer M Krug <r.m.k...@gmail.com> napsal dne 07.10.2009 12:40:39:
>
> >
>
> > On Wed, Oct 7, 2009 at 12:26 PM, Petr PIKAL <petr.pi...@precheza.cz>
> wrote:
> > Hi
> >
> > Rainer M Krug <r.m.k...@gmail.com> napsal dne 07.10.2009 12:09:21:
> >
> > >
> >
>
> <snip>
>
> > In the meantime, what about
> >
> > x <- rnorm(200)
> > hist(x, col = "blue", freq = TRUE)
> > ddd<-density(x)
> > lines(ddd$x, ddd$y*100, col = "red", lwd = 2)
> >
> > and then add suitable y axis.
> >
> > axis(4, at=pretty(ddd$y*100), labels=pretty(ddd$y), col=2)
> >
> > Yes - that definitely works.
> >
> > I usually use the following approach: determine the xlims in advance,
> and then
> > set them manually for each plot:
> >
> > x <- rnorm(200)
> > xlim <- trunc(range(x)) + c(-1, +1)
> >
> > hist(x, col = "blue", freq = TRUE, xlim=xlim)
>
> hhh <- hist(x, col = "blue", freq = TRUE)
>
> gives you object from which you can extract limits for plotting maybe
> better then from original data and you do not need to call
>
> > par(new=TRUE)
>
> True.

Thanks a lot,

Rainer


> Regards
> Petr
>
> > plot(density(x), xlim=xlim, ann=FALSE, axes=FALSE)
> > axis(4)
> >
> > But it is sometimes tricky to get the xlims for the plot.
> >
> > Regards
> > Petr
> >
>
>


-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:           +27 - (0)83 9479 042
Fax:            +27 - (0)86 516 2782
Fax:            +49 - (0)721 151 334 888
email:          rai...@krugs.de

Skype:          RMkrug
Google:         r.m.k...@gmail.com

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to