Re: [R] Define ylim in lattice plot based upon panel function output

From: Sébastien Bihorel <pomchip_at_free.fr>
Date: Tue, 19 Apr 2011 07:43:12 -0400

Dear Deepayan,

Thank you for pointing out those functions. They will be helpful to me. If you don't mind, I may get back to you on that topic if I cannot find a way to apply them to my actual problem (the example I gave was just for illustration). This problem is more complex and involves multiple panel.xyplot, panel.superpose, panel.abline, panel.loess, panel.lines and grid.polygon calls, all conditional on the settings of the xyplot call... This is going to be fun

Sebastien

On Mon, Apr 18, 2011 at 10:46 PM, Deepayan Sarkar <deepayan.sarkar_at_gmail.com
> wrote:

> On Tue, Apr 19, 2011 at 7:38 AM, Sébastien Bihorel <pomchip_at_free.fr>
> wrote:
> > Dear R-users,
> >
> > By default, the xyplot function automatically defines the axis ranges
> based
> > upon the content of y and x variables. However, when one includes some
> calls
> > to other panel.<something> functions in the panel argument, the results
> > might be out of range and not show up in the final graphs (see lower ends
> of
> > the loess line in the following example). Is there a way one can capture
> the
> > results of the functions to update the graph object and set the xlim and
> > ylim?
>
> Read up on the 'prepanel' argument (in ?xyplot). What you want is
> actually already defined -- see ?prepanel.loess.
>
> xyplot(y~x,data=df,
> prepanel = prepanel.loess,
> panel=function(x,y,...){
> panel.xyplot(x,y)
> panel.loess(x,y)
> })
>
> -Deepayan
>
> >
> > Thanks
> >
> > Sebastien
> >
> > require(lattice)
> >
> > df <- data.frame(x=seq(1,30,1),
> > y=c(rep(0,10),rep(10,10),rep(0,10)))
> >
> > xyplot(y~x,data=df,
> > panel=function(x,y,...){
> > panel.xyplot(x,y)
> > panel.loess(x,y)
> > })
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_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.
> >
>

        [[alternative HTML version deleted]]



R-help_at_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. Received on Tue 19 Apr 2011 - 11:48:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 19 Apr 2011 - 11:50:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive