[英]R: exclude colorbar from lattice heatmap
I am using the lattice
package to plot heatmaps. 我使用的是
lattice
封装来绘制热图。 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
. 假设您从点阵中引用了
levelplot
,则可以通过指定colorkey = FALSE
轻松禁用colorkey = FALSE
。 In fact, this is done in the first example of ?levelplot
. 实际上,这是在
?levelplot
的第一个示例中?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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.