【发布时间】:2021-11-05 22:13:27
【问题描述】:
大家晚上好,
我的图表有两个主要问题。第一个是图例显示不正确的形状。它不是显示平均值的形状,而是显示异常值的形状 please see attached.
此外,当我尝试运行时
geom_signif(comparisons = list(c("Blank", "Vehicle - Vehicle")), map_signif_level = TRUE, colour = "#cf1b1b") 代码,I am getting the following error
我不明白 R 要求什么值。一开始,我只是想可能是因为数据没有标准化并且我正在使用小值,它只是在 y 轴上没有足够的空间来显示map_signif_level = TRUE,但在另一个示例中,它显示了map_signif_level = TRUEcorrectly。所以,我不明白为什么它有时会正确显示my_comparisons,有时却不正确。
这些是我用来生成上图的以下代码:
library(tidyverse)
library(ggplot2)
library(ggpubr)
ggplot(PhospholipaseA2NOPo1, aes( x = Drug, y = Absorbance))+
geom_line(aes(linetype='median'),size=1)+
geom_point(aes(shape='mean'),size=3)+
ggtitle("Comparison of the effect of Blank, Vehicle - Vehicle, Vehicle - Nicotinic Acid, SP - Vehicle, and SP -Nicotinic Acid on microglia - Phospholipase A2 Assay ") +
labs(x = expression(paste("Treatment")))+
ylab(expression(paste("Absrobance " ~ "(", A[425], " - ", A[600] ~ nm, ")"))) +
stat_summary(fun=mean, colour="black", geom="point",
shape=18, size=3) +
geom_point() +
scale_x_discrete(labels = c("Blank", "Vehicle- Vehicle", "Vehicle - Nicotinic Acid", "SP - Vehicle", "SP - Nicotinic Acid"))+
stat_compare_means(label.y = 0.50,
label.x = 3.25)+
geom_boxplot(fill=c("#2171B5","#DEEBF7", "#CC79A7", "#CC79A7", "#CC79A7"), width=0.2,notch = FALSE)+
geom_signif(comparisons = list(c("Blank", "Vehicle - Vehicle")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Blank", "Vehicle - Nicotinic Acid")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Blank", "SP - Vehicle")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Blank", "SP - Nicotinic Acid")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Vehicle - Vehicle", "Vehicle - Nicotinic Acid")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Vehicle - Vehicle", "SP - Vehicle")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Vehicle - Vehicle", "SP - Nicotinic Acid")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Vehicle - Nicotinic Acid", "SP - Vehicle")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("Vehicle - Nicotinic Acid", "SP - Nicotinic Acid")), map_signif_level = TRUE, colour = "#cf1b1b")+
geom_signif(comparisons = list(c("SP - Vehicle", "SP - Nicotinic Acid")), map_signif_level = TRUE, colour = "#cf1b1b")+
theme_bw() +
theme(panel.grid.major = element_line(colour = "#d3d3d3"),
panel.grid.minor = element_blank(),
panel.border = element_blank(), panel.background = element_blank(),
plot.title = element_text(size = 14, face = "bold"))+
theme(axis.text.x = element_text(face="bold", color="#3142b0",
size=8.9, angle=0),
axis.text.y = element_text(face="bold", color="#3142b0",
size=8.9, angle=0))+
scale_linetype_manual('Legend',values='solid')+
scale_shape_manual('',values = 18)+
theme(legend.spacing.y = unit(0.01, "cm"))
为了生成上图,我使用了the following data。
非常感谢您的热心帮助。
【问题讨论】: