On Wed, Oct 7, 2009 at 11:28 AM, Petr PIKAL <petr.pi...@precheza.cz> wrote:

> Hi
>
> Try ?twoord.plot from plotrix package.
>
>
Thanks Petr - I was not aeware of this command.
But I would prefer a more general solution. An example on where I am using
is, to plot a histogram overlayed by its density estimate (easier to digest
for others then only a density estimate).

And a newY() (or par(newY=TRUE) command would enable exactly this.

Regards,

Rainer



> Regards
> Petr
>
>
>
> r-help-boun...@r-project.org napsal dne 07.10.2009 10:29:53:
>
> > Hi
> >
> > is there an alternative to par(new), for ading data to a plot for a
> > different y-axis?
> > My problem with par(new=TRUE) is, that it re-defines all axis and labels
> (as
> > in example 1) and one has to use xlim=... to fix the x-axis.
> > I am looking for something, which simply resets the y-axis, so that a
> new
> > plot() (or points()/lines()) keeps the x-axis, but re-defines the
> y-axis.
> >
> > Is there something available? I could re-scale the y-data to fit the
> > existing y-axis, but that would mean to define all the labels and
> tickmarks
> > for axis 4 manually.
> >
> > HEre is an example about what I mean:
> >
> > x1 <- 1:10
> > y1 <- runif(10)
> > x2 <- 1:11
> > y2 <- c(y1*100, 0)
> >
> > ## (1) Does not plot points where (x-axis) they should be
> > plot(x1, y1, type="l")
> > par(new=TRUE)
> > plot(x2, y2, type="p")
> > axis(4)
> >
> > ## (2) Does plot points where (x-axis) they should be
> > xlim <- range(x1)
> > plot(x1, y1, type="l", xlim=xlim)
> > par(new=TRUE)
> > plot(x2, y2, type="p", xlim=xlim)
> > axis(4)
> >
> > Cheers,
> >
> >
> > Rainer
> > --
> > 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.
>
>


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