1

嗨,我的数据(data_long)如下所示:

 genes  sample  value   Group Type
 A1 O7high  6796.448    G0   A
 AA O7high  4997.250    G0   A
 A3 O7high  9477.100    G0   A
 A4 O7high  6083.558    G0   A   
 A1 08low   075.364     G0   B
 AA 08low   13066.130   G0   B

p <- ggplot(data_long, aes(x=sample, y=value,group=genes,color=Group))  + 
  geom_tile(aes(fill = as.factor(Type),color = NA,y = 7000), height = Inf, alpha = 0.5) +
  geom_line(aes(linetype=Group,color=Group, size=Group)) + 
  stat_summary(aes(group = -1), fun=median, geom='line',size=2, color='orange') + 
  theme_classic() + 
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  scale_y_sqrt()+
  scale_colour_manual(values=c("black","blue"))+
  scale_size_manual(values=c(0.3,1.5))+
  scale_linetype_manual(values=c("dashed", "solid"))+
  theme_classic()

p + theme_bw() +
  theme(panel.grid = element_blank(),
        panel.border = element_blank())

我已经使用上面的代码来绘制中线以及突出显示我感兴趣的一些基因。一切正常,但是当看到绘图时,有这些垂直的灰线(分隔每个样本?)我不知道如何删除这些线。我希望相同类型的 geom_tile 没有任何线条。请让我知道如何删除这些行

在此处输入图像描述

4

1 回答 1

0

感谢您使用所需信息更新您的问题。color = NA也许你可以通过向外移动来消除灰线aes(),例如

library(tidyverse)
data_long <- read.table(text = "genes  sample  value   Group Type
A1 O7med  6796.448    G0   A
AA O7med  4997.250    G0   A
A3 O7high  9477.100    G0   A
A4 O7high  6083.558    G0   A   
A1 08low   075.364     G0   B
AA 08low   13066.130   G0   B", header = TRUE)

p <- ggplot(data_long, aes(x=sample, y=value,group=genes,color=Group))  + 
  geom_tile(aes(fill = as.factor(Type), y = 7000), color = NA, height = Inf, alpha = 0.5) +
  geom_line(aes(linetype=Group,color=Group, size=Group)) + 
  stat_summary(aes(group = -1), fun=median, geom='line',size=2, color='orange') + 
  theme_classic() + 
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))+
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  scale_y_sqrt()+
  scale_colour_manual(values=c("black","blue"))+
  scale_size_manual(values=c(0.3,1.5))+
  scale_linetype_manual(values=c("dashed", "solid"))

p + theme_bw() +
  theme(panel.grid = element_blank(),
        panel.border = element_blank())

reprex 包(v2.0.1)于 2021 年 10 月 13 日创建

这适用于您的实际数据集吗?

于 2021-10-12T22:33:32.100 回答