0

I am attempting to change the numeric values on the axis to strings of my choosing. The purpose is to replace numeric dates with '%m/%d/%y' format.

library(lattice)
#set up some simplified data
x <- seq(41600, 41630, 1)
y <- seq(0, 30, 1)

# Desired names in X axis
datenames <- as.Date(seq(41600, 41630, 5), origin="1899-12-30")

myGrid <- data.frame(expand.grid(x,y))
colnames(myGrid) <- c("x","y")
myGrid$z <- myGrid$y

wireframe(
  myGrid$z ~ myGrid$x * myGrid$y, 
  xlab="Date", ylab="Y", zlab="Z",
  scales = list(z.ticks=5, arrows=FALSE, col="black", font=3, tck=1)
)

enter image description here

John Paul
  • 12,196
  • 6
  • 55
  • 75
rrbest
  • 1,619
  • 3
  • 14
  • 22

1 Answers1

0

Each axis can be customized individually by supplying their parameters in a list named x, y or z.

wireframe(
  myGrid$z ~ myGrid$x * myGrid$y, 
  xlab="Date", ylab="Y", zlab="Z",
  scales = list(x=list(at=seq(41600, 41630, 5), labels=datenames),
                arrows=FALSE, col="black", font=3, tck=1)
)

enter image description here

Backlin
  • 14,612
  • 2
  • 49
  • 81