首页 > 解决方案 > 在 DESeq2 PCA 上为不同的 geom_point 形状添加黑色轮廓

问题描述

我正在使用 DESeq2 包运行 PCA,并希望在已经基于观察的形状上获得黑色轮廓。圆形的工作,但其他形状没有。

例如Make stat_ellipse {ggplot2} outline geom_point fill colorPlace aborder around points将数据绘制为一个唯一的形状。

很难给出一个可重现的例子,因为它以前在一个大数据集上执行过 PCA,但这是我运行的以下内容:

ggplot(pcaData, aes(x = PC1, y = PC2, color = dFe, shape = location))+   
geom_point(size=5)+  
geom_point(aes(PC1, PC2, color = dFe, shape = location), shape= 21, colour="black", size= 5)

我相信关键在于新层的编码geom_point

在此处输入图像描述

跑步scale_fill_manual I get the following

ggplot(pcaData, aes(x = PC1, y = PC2, color = dFe, shape = location))+   
geom_point(size=5)+  scale_shape_manual(values=c(21,22,23))

在此处输入图像描述

标签: rggplot2pcarna-seq

解决方案


正如我在评论中提到的,使用scale_shape_manual并提供fill美学:

ggplot(pcaData, aes(x = PC1, y = PC2, fill = dFe, shape = location)) +
    geom_point(color = 'black', size = 5) +
    scale_shape_manual(values = c(21L, 22L, 23L))

在此处输入图像描述


推荐阅读