我刚刚做了这个图表
使用这组数据
G | T |
---|---|
1 | 7 |
1 | 9 |
1 | 8 |
1 | 7 |
1 | 6 |
1 | 8 |
1 | 7 |
1 | 8 |
1 | 7 |
1 | 7 |
1 | 6 |
1 | 7 |
1 | 7 |
1 | 9 |
1 | 9 |
2 | 9 |
2 | 7 |
2 | 8 |
2 | 8 |
2 | 9 |
2 | 8 |
2 | 9 |
2 | 7 |
2 | 10 |
2 | 9 |
2 | 7 |
2 | 8 |
2 | 8 |
2 | 7 |
2 | 8 |
3 | 16 |
3 | 17 |
3 | 19 |
3 | 17 |
3 | 17 |
3 | 18 |
3 | 17 |
3 | 19 |
3 | 18 |
3 | 17 |
3 | 18 |
3 | 19 |
3 | 19 |
4 | 17 |
4 | 18 |
4 | 16 |
4 | 18 |
4 | 18 |
4 | 20 |
4 | 15 |
4 | 16 |
4 | 20 |
4 | 17 |
4 | 17 |
4 | 19 |
4 | 19 |
这段代码:
ggplot(Raiz, aes(x = G, y = T,
color = c('WT', 'at5g01950')[2 - (as.numeric(G) %% 2)])) +
geom_jitter(position = position_jitter(width = 0.2), alpha = 1, size =3) +
geom_boxplot(width = 0.5, color = "black", alpha = 0.2,
position = position_dodge(0.9)) +
theme_minimal() +
theme(plot.background = element_rect(fill = "white") ,
panel.grid.minor = element_blank()) +
labs(color = '')
我想知道如何在每次治疗的测量值对之间留出空格。例如:1,2 - 空格 - 3,4 .... 不是一个很大的空格,但足以轻松区分治疗。
library(ggplot2)
Raiz <- data.frame(G = rep(seq(1:6), each = 10),
T = sample.int(20, 60, replace = T))
ggplot(Raiz, aes(x = as.factor(G), y = T,
color = c('WT', 'at5g01950')[2 - (as.numeric(G) %% 2)],
group = G)) +
geom_jitter(position = position_jitter(width = 0.2), alpha = 1, size =3) +
geom_boxplot(width = 0.5, color = "black", alpha = 0.2,
position = position_dodge(0.9)) +
theme_minimal() +
facet_wrap(~(G-1)%/%2, scales = "free_x", nrow = 1) +
theme(plot.background = element_rect(fill = "white") ,
panel.grid.minor = element_blank(),
strip.text.x = element_blank()) +
labs(color = '', x = "G")
创建于 2024-01-08,使用 reprex v2.0.2