rlatticewireframe

force x and y axes to be drawn at the bottom of wireframe plot (lattice library)


How do I force the x and y axes of the figure below to be drawn at the bottom of the cube, rather than at the top?

enter image description here

Currently, the axes are automatically drawn above the cube when the z parameter (inside screen=...) falls below -90.

Code used to generate the figure:

library(lattice)
D <- expand.grid(x=seq(1,10), y=seq(1,10))
D$z <- D$x-D$y
wireframe(z ~ x * y, data=D, screen=list(z=-120, x=-60))

Many thanks!


Solution

  • From ?panel.cloud # since wireframe calls panel.cloud

    scpos: A list with three components x, y and z (each a scalar integer), describing which of the 12 sides of the cube the scales should be drawn. The defaults should be OK. Valid values are x: 1, 3, 9, 11; y: 8, 5, 7, 6 and z: 4, 2, 10, 12. (See comments in the source code of panel.cloud to see the details of this enumeration.)

    # Didn't look up the source code. Was easy enough to experiment
    wireframe(z ~ x * y, data=D, screen=list(z=-120, x=-60), scpos=list(x=9,y=5,z=2))
    

    enter image description here