Reputation: 964
I am using levelplot from R lattice package. I would like to make axis with my custom ticks and labels. Currently, I have the following:
I would like both axis be marked as the following: -pi, -0.5pi, 0, 0.5pi, pi, etc...
Upvotes: 0
Views: 400
Reputation: 3694
Something like this?
library(lattice)
x <- seq(pi / 4, 5 * pi, length.out = 100)
y <- seq(pi / 4, 5 * pi, length.out = 100)
r <- as.vector(sqrt(outer(x ^ 2, y ^ 2, "+")))
grid <- expand.grid(x = x, y = y)
grid$z <- cos(r ^ 2) * exp(-r / (pi ^ 3))
levelplot(z ~ x * y, grid, cuts = 50,
scales = list(y = list(at = c(pi, 2 * pi, 3 * pi, 4 * pi),
label = c("pi", "2pi", "3pi", "4pi"))))
By the way, please do create your own reproducible example next time.
Upvotes: 1