我正在使用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
我想要什么(来自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
(对不起,不能发布任何图片)
谢谢!
最佳答案
只需将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")
将为您提供此图,并在图块之间加上线条:
您可以使用
size
来放大或缩小线条,和/或使用color = white
。
关于r - 单元格之间的ggplot图 block 线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32665431/