Chek the topic "Second y-axis --- alternative to par(new=" which was
discussed recently - in that one, there are a few examples, how that can be
achieved.

Essentially, you have to make sure, that the xlims of the hist() and
plot(density()) are the same, and you have to use the par(new=TRUE) (or
FALSE - I always forget) before the plot(density())

Cheers,

Rainer

On Mon, Nov 30, 2009 at 2:51 PM, Hrishi Mittal <hrishimittal@gmail.com>wrote:

>
> Trafim,
>
> If you are plotting more than one variables on the same plot e.g. by using
> the lines() or points() function, then the limits of the X and Y axes are
> set based on the first variable you plot. So, you would have to set the
> xlim
> and ylim to the limits of the variable with the widest range, otherwise you
> would sometimes see some data left out.
>
> Check the topic "Second y-axis --- alternative to par(new=" which was
discussed recently - in that one, there are a few examples, how that can be
achieved.

Essentially, you have to make sure, that the xlims of the hist() and
plot(density()) are the same, and you have to use the par(new=TRUE) (or
FALSE - I always forget) before the plot(density())

Cheers,

Rainer


> --
> View this message in context:
> http://n4.nabble.com/Histogram-and-Density-on-the-the-same-graph-tp931182p931236.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
NEW GERMAN FAX NUMBER!!!

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)321 2125 2244
email:          Rainer@krugs.de

Skype:          RMkrug
Google:         R.M.Krug@gmail.com

	[[alternative HTML version deleted]]


