更改热图的比例以显示更多颜色
Change Scale of Heatmap to Show More Colours
我目前有一些类似于下面的数据,网格可能更精细。我想知道是否可以使 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")
我目前有一些类似于下面的数据,网格可能更精细。我想知道是否可以使 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")