[R] panel function problem with ps

About this list Date view Thread view Subject view Author view Attachment view

From: Andy Bunn (abunn@montana.edu)
Date: Tue 03 Jun 2003 - 07:20:04 EST


Message-id: <1054588804.12517.26.camel@facet.msu.montana.edu>

Hi, I have an elaborate coplot for which I had to write my very first
panel statement. It looks fine on the screen (in an x11 device) but does
not go to postscript correctly. Not even close actually. This is the
only one of my r scripts that hasn't run perfectly under linux and I'm
generally very pleased at how smoothly the transistion has been from R
under windows to ESS-style R.

However, I've made this plot under windows and saved it just fine and am
ready to admit a problem with my panel function. I'm just not sure what
it is.

The coplot is a double conditioning plot and I'm adding a spline to each
panel. So, I'm trying to use the subscripts argument.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~
postscript("foo.ps")
coplot(x.var ~ y.var | m.var * n.var,
       given.v = list(m.var.overlap, n.var.overlap),
       subscripts = T, aspect = "xy",
       panel = function(x, y, subscripts, ...){

       #Add points
       points(x, y, col = "gray50")

       #Make and draw a spline in each panel
       spline.model <- smooth.spline(y.var[subscripts],
                                     x.var[subscripts])
       thefits <- predict(spline.model, y.var)$y
       sp <- spline(x, thefits[subscripts])

       #Add lines
       lines(sp$x, sp$y, col = "black", lwd = 4)
       })
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Any help appreciated.

-Andy

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Tue 01 Jul 2003 - 09:11:52 EST