I am using the lattice
package to plot heatmaps. For some plots I would like to exclude the colorbar that is printed automatically next to the plot. Unfortunately, I could not find an option to hide it. Is there an easy way to achieve this?
Assuming you are referring to levelplot
from lattice , colorkeys can easily be disabled by specifying colorkey = FALSE
. In fact, this is done in the first example of ?levelplot
.
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(log = "e"), xlab = "",
ylab = "", main = "Weird Function", sub = "with log scales",
colorkey = FALSE, region = TRUE)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.