【问题标题】:R: exclude colorbar from lattice heatmapR:从晶格热图中排除颜色条
【发布时间】:2016-07-27 15:00:30
【问题描述】:

我正在使用lattice 包来绘制热图。对于某些图,我想排除在图旁边自动打印的颜色条。不幸的是,我找不到隐藏它的选项。有没有简单的方法来实现这一点?

【问题讨论】:

    标签: r heatmap lattice colorbar levelplot


    【解决方案1】:

    假设您指的是 lattice 中的 levelplot,则可以通过指定 colorkey = FALSE 轻松禁用颜色键。其实在?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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-12-26
      • 1970-01-01
      • 2016-07-20
      • 1970-01-01
      • 2019-03-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多