小编Kev*_*in 的帖子

R - ggplot geom_dotplot形状选项

我想geom_dotplot通过点的形状(而不是文档建议的颜色)来区分两个不同的变量.例如:

library(ggplot2)
set.seed(1)
x = rnorm(20)
y = rnorm(20)
df = data.frame(x,y)
ggplot(data = df) + 
   geom_dotplot(aes(x = x), fill = "red") + 
   geom_dotplot(aes(x=y), fill = "blue")
Run Code Online (Sandbox Code Playgroud)

即在下面的例子中区分x和y

在此输入图像描述

我想将所有x设置为点,将y设置为三角形.

这可能吗?谢谢!

r data-visualization shape ggplot2

8
推荐指数
1
解决办法
2439
查看次数

单元格之间的ggplot tile线

我正在使用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)

(抱歉无法发布任何图片)谢谢!

r heatmap ggplot2

5
推荐指数
1
解决办法
3357
查看次数

标签 统计

ggplot2 ×2

r ×2

data-visualization ×1

heatmap ×1

shape ×1