r - 更改热图的比例以显示更多颜色
问题描述
我目前有类似于下面的数据,可能有更精细的网格。我想知道是否有可能使网格ggplot heatmap
更精细?意思是为不同的值提供更多的颜色z
。截至目前,我当前的情节主要是 1 颜色,因为它们都在1e-2
和之间1e-5
,但我有一个值,1e-13
似乎根本看不到它。
x <- seq(3, 5, by = 1)
y <- seq(5, 101, by = 2)
z <- seq(3, 10^-13, length = 146)
### Combinations
combinations <- expand_grid(x, y) %>%
subset(y > x) %>%
cbind(z) %>%
as.matrix()
combinations %>%
ggplot(aes(x = x, y = y)) +
geom_tile(aes(fill = z))
提前致谢。
解决方案
或者是关于它的?
x <- seq(3, 5, by = 1)
y <- seq(5, 101, by = 2)
z <- seq(3, 10^-13, length = 146)
combinations <- expand_grid(x, y) %>%
subset(y > x) %>%
cbind(z)
combinations %>%
ggplot(aes(x, y, z=z)) +
geom_contour_filled()+
geom_point(data = combinations %>% filter(z<1e-6),
size=10, color = "red")
这样做。它必须工作!
library(tidyverse)
library(ggplot2)
x <- seq(3, 5, by = 1)
y <- seq(5, 101, by = 2)
z <- seq(3, 10^-13, length = 146)
combinations <- expand_grid(x, y) %>%
subset(y > x) %>%
cbind(z)
combinations %>%
ggplot(aes(x, y, z=z)) +
geom_contour_filled()+
geom_point(data = combinations %>% dplyr::filter(z<1e-6),
size=10, color = "red")
推荐阅读
- assembly - 炸弹实验室作业第 5 阶段 - 编写其 C 等效项
- python - 如何将 Pandas DataFrame 的行推进到下一个值?
- haskell - 当字符串中包含撇号时,单词会返回错误的输出
- bootstrap-4 - 打开手风琴时模态关闭 - Bootstrap
- algorithm - 如何在没有立方坐标的情况下找到多边形的质心?
- ruby-on-rails - 关于 AVRO 规范和创建简单 REST 端点的问题
- scala - Scala Spark不读取忽略第一行标题并从第二行开始加载所有数据
- python - 遍历txt文件中的行时,如何在正则表达式触发后捕获多个后续行?
- php - laravel 检查金额是否在记录之间
- spring - 关于使用 Jackson 展平嵌套 json 的查询