我做了一個ggplot,按孵化的小時數著色。當我使用geom_signif添加顯著性條時,它們都是按第一種顏色著色的,這里是粉紅色。理想情況下,我希望能夠選擇顯著性條的顏色,這樣我就可以指出它們指的是哪個孵化時間。或者,如果這不可能,我將如何使它們變成黑色?
ggplot(data = data, 映射= aes(y = Fluorescence, x =治療。 色=小時))
geom_boxplot(outlier.shape = NA)
geom_jitter(position = position_jitterdodge(jitter. width = 0.3, jitter. height = 0), alpha = 0。 4)
主題(axis.text。 x = element_text(angle = 60。 hjust = 1))
xlab("Treatment")
ylab("Mean fluorescence"/span>)
ggtitle("C6/36")
geom_signif(y_position = c(5。 8,6.3, 2. 5,2,1. 5,1),
xmin = c(2。 3,2, 2。 8,1.8,1。 8,2.8),
xmax = c(3。 4, 4。 10, 3. 8,2.8,3。 8),
注釋 = c("****"/span>。 "****","ns"。 "****", "****", "ns","**"),
textsize=3.5)
uj5u.com熱心網友回復:
如果你只為boxplot geom設定了顏色映射,著色將只應用于這個特定的geom:
library(tidyverse)
library(ggsignif)
iris %>%
mutate(group = Species %in% c("setosa"/span>。 "versicolor") %> %
ggplot(aes(group, Sepal. 長度))
geom_boxplot(aes(color =) operator">= Species))
geom_jitter(aes(color =) operator">= Species))
geom_signif(comparisons = list(c("TRUE"。 "FALSE")))

創建于2021-09-14,由reprex軟體包(v2.0.1)
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/318946.html
標籤:

