【发布时间】:2022-01-23 16:59:14
【问题描述】:
我在多面 boxplot 中表示了三组(组织)和两组(治疗),我想删除“治疗”的图例,因为它已经在图中表示,并保留“治疗”的图例组织”。
box <- ggboxplot(subclusDF, x = 'Treatment', y = 'ATP4', fill = "Tissue", color = 'Tissue', palette = qualitative_hcl(3, palette = 'Dark 3'), add = 'jitter', shape = 'Treatment' )
box <- box + labs(title= 'GHRL') + xlab(NULL) + ylab("Expression") + facet_grid(~Tissue)
box
box + theme()+
theme(
plot.title = element_text(face = "bold", size = 12),
legend.background = element_rect(fill = "white", size = 4, colour = "white"),
legend.justification = c(0, 1),
legend.title=element_text(NULL),
legend.key = element_blank(),
legend.position = c(0, 1),
axis.text = (NULL),
axis.ticks = element_line(colour = "grey70", size = 0.2),
panel.grid.major = element_line(colour = "grey70", size = 0.2),
panel.grid.minor = element_blank()
)
box
【问题讨论】:
-
最好包含您的代码,以便我们为您提供具体反馈。编辑:检查cookbook。
-
谢谢你,我想专门删除一个图例而不是另一个,所以不确定食谱是否能处理,但会再看一遍
-
您可以尝试
+ scale_shape_discrete(guide = "none"),但这是未经测试的猜测,因为我无法重现该问题。或+ guides(shape = "none"). -
这能回答你的问题吗? Remove legend ggplot 2.2