我正在使用ggplot并geom_tile形成热图.我希望在细胞之间插入一些微弱的线条.
例如:
我的ggplot geom_tile热图:
library(ggplot2)
library(reshape2)
data("iris")
x = melt(cor(iris[,1:4]))
ggplot(data=x,aes(Var1,Var2,fill=value)) + geom_tile() # No line between the cells
Run Code Online (Sandbox Code Playgroud)
我想要什么(来自R中的d3heatmap包)
library(d3heatmap)
data("iris")
x = cor(iris[,1:4])
d3heatmap(cor(iris[,1:4]),Rowv = F,Colv = F) #There is a faint line between the cells
Run Code Online (Sandbox Code Playgroud)
(抱歉无法发布任何图片)谢谢!
只需添加color = "gray"到您的geom_tile
library(ggplot2)
library(reshape2)
data("iris")
x = melt(cor(iris[,1:4]))
ggplot(data=x,aes(Var1,Var2,fill=value)) +
geom_tile(color = "gray")
Run Code Online (Sandbox Code Playgroud)
您可以使用size以使线条更大或更小,和/或使用color = white.
| 归档时间: |
|
| 查看次数: |
3357 次 |
| 最近记录: |