[R-gui] Lattice graphics

Felix Andrews felix at nfrac.org
Thu Jul 3 11:51:40 CEST 2008


You are using the wrong locations for "at".
There is nothing in f_xy that defines the -3:3 scale.

x <- matrix(round(seq(-3.4,3.4,0.2), 2), ncol=1);
f_xy <- dnorm(x)%*%t(dnorm(x))

labat <- which(x %% 1 == 0)

wireframe(f_xy, col="blue", pretty=TRUE, drape=TRUE,
      scales=list(arrows=FALSE,
         x=list(at=labat,labels=x[labat]),
         y=list(at=labat,labels=x[labat]) ),
      xlab="x",
      ylab="y",
      zlab=list(expression(f[xy])),
      main="Bivariate Normal Density")


On Sat, Jun 28, 2008 at 3:55 AM, H. Lawrence Hotchkiss
<larryh at zebra.us.udel.edu> wrote:
> Hi,
>
> I have not been able to control the tick-mark locations and labels in a
> wireframe plot.  I've been using the scales= option, like this:
>
>       scales=list(arrows=FALSE,
>          x=list(at=seq(-3,3),labels=paste("-3":"3")),
>          y=list(at=seq(-3,3),labels=paste("-3":"3")) ),
>
> If there are no dimnames on the input matrix, I get 3 tick marks and three
> labels bunched at the low end of the x and y axes. But if there are dimnames on
> the input matrix, I get a bunch of uninterpretable overprints.
>
> If I designate tick.number=7 instead of at=, I get 7 tickmarks, but not at the
> correct locations. And the labels are started in the second position ("-2")
> leaving the last one printed "NULL". (I can fix this by prepending a "dummy"
> value to the labels labels=paste("-4":"3") ).
>
> The help for wireframe (and cloud) says the following:
>
> Other components that work in the scales argument of xyplot etc. should also
> work here (as long as they make sense), including explicit specification of tick
> mark locations and labels. (Not everything is implemented yet, but if you find
> something that should work but does not, feel free to bug the maintainer.)
>
> I wonder if at= and labels= lists are among the features that don't work yet.
>
> I'm running R 2.7.0 for Windows and just downloaded the lattice package to be
> sure I have the latest version.
>
> Here are selected examples:
>
> ------------------------------------------------------------------------------
> # Generate input data
> x <- matrix(round(seq(-3.4,3.4,0.2), 2), ncol=1);
> f_xy <- dnorm(x)%*%t(dnorm(x))
>
> # No specification of tick location or labels
> wireframe(f_xy, col="blue", pretty=TRUE, drape=TRUE,
>       scales=list(arrows=FALSE),
>       xlab=list(expression(x)),
>       ylab=list(expression(y)),
>       zlab=list(expression(f[xy])),
>       main="Bivariate Normal Density")
>
> # Specification of tick location and labels, using x & y sub lists of
> # scales.  Bunches 3 tick marks and 3 values at the low end of
> # the x and y axes.
> wireframe(f_xy, col="blue", pretty=TRUE, drape=TRUE,
>       scales=list(arrows=FALSE,
>          x=list(at=seq(-3,3),labels=paste("-3":"3")),
>          y=list(at=seq(-3,3),labels=paste("-3":"3")) ),
>       xlab=list(expression(x)),
>       ylab=list(expression(y)),
>       zlab=list(expression(f[xy])),
>       main="Bivariate Normal Density")
>
> # Add dimnames to f_xy. Set to "", dimnames that I do not want in the
> # graph labels. This works, except that there still is no control
> # over the location of the tick marks.
> vnames <- rep("",35); ii <- 0
> for(i in 1:7) {
>  ii <- ii+3
>  vnames[ii] <- paste(x[ii])
>  ii <- ii+2
> }
> dimnames(f_xy) <- list(vnames,vnames)
> wireframe(f_xy, col="blue", pretty=TRUE, drape=TRUE,
>       scales=list(arrows=FALSE,x=list(tick.number=7)),
>       xlab=list(expression(x)),
>       ylab=list(expression(y)),
>       zlab=list(expression(f[xy])),
>       main="Bivariate Normal Density")
> ------------------------------------------------------------------------------
>
> Thanks,
>
> Larry Hotchkiss
>
>
>
> Larry Hotchkiss
> University of Delaware
> IT User Services -- Smith Hall
> Newark, DE 19716
> 302-831-1989  larryh at zebra.us.udel.edu
>
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-gui
>



-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8



More information about the R-SIG-GUI mailing list