ggpairs
提供了带有两个框形图的图形,这些框形图连接了点,以显示干预后的情况。
要更改y轴标签“ Resist”“ Suscept”,而不是“ 3GCr”和“ 3GCs”。
并且想要更改具有默认形状的数据点,例如 Resist =圆圈(1)&Suscept =钻石(5)
搜索了多个站点,但未获得所需的结果。 还要添加代码并输出:
df.reach.sub <- data.frame(Resist = c(5.78, 3.85, 5.60, 7.83, 6.68, 7.90), Suscept =c(5.70, 3.70, 8.82, 8.67, 9.06, 8.08), Age = c(1,1,1,1,1,1), Status = c("Positive", "Positive", "Positive", "Positive", "Positive", "Positive"))
df.reach.subCat1 <- df.reach.sub[which(df.reach.sub$Age == "1-3" & df.reach.sub$Status == "Positive"),]
gp.plotCat1 <- ggpaired(df.reach.subCat1, cond1 = "Resist", cond2 = "Suscept", color = "Black", line.color = "gray", line.size = 0.4, palette = "npg", ylab = expression('log'[10]*' CFU / g faeces'), xlab = NULL, main = expression("A) 1-3 months ("*italic('p = 0.116, n = 6')*')'), legend = "none", ggtheme = theme_bw(), ylim = c(2,10))
gp.plotCat1
答案 0 :(得分:0)
我建议像这样使用一些tidyverse
和“基本” ggplot2
df.reach.sub %>%
rownames_to_column() %>%
gather(key, value, -Age, -Status, -rowname) %>%
ggplot(aes(key, value)) +
geom_boxplot() +
geom_point(aes(shape=key), show.legend = F, size=2) +
geom_path(aes(group=rowname)) +
theme_bw()