[R-gui] Lattice graphics

H. Lawrence Hotchkiss larryh at zebra.us.udel.edu
Fri Jun 27 19:55:47 CEST 2008


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



More information about the R-SIG-GUI mailing list