I’m doing a cleveland dot plot in R. I have the months on x axis and species on y axis. The species are duplicated cause one is from phenology and the other is for seeds on birds feces, so I colored them differently. The graph looks good, but I’m trying to get a different spacing between different species, but I can’t seem to get it done. I don’t even know it that’s possible. Can someone help me?
Here’s my code:
spp com fim classe cat
1 Casearia sylvestris 1 3 1 1
2 Pera glabrata 4 5 1 2
3 Trichilia pallida 1 2 1 3
4 Trichilia pallida 10 11 1 3
5 Casearia sylvestris. 1 5 2 1
6 Pera glabrata. 9 11 2 2
7 Pera glabrata. 1 5 2 2
8 Trichilia pallida. 9 11 2 3
9 Trichilia pallida. 1 2 2 3
duracao_pheno_birds <- ggplot(seeds_sync, aes(x = com, y = spp, xend = fim, yend = spp,
group = spp, color = factor(classe))) +
geom_segment(size = 2) +
geom_point(aes(color = factor(classe)), size = 3.5) +
geom_point(aes(x = fim, y = spp, color = factor(classe)), size = 3.5) +
labs(x = "Meses", y = "Espécies", color = "Categorias") +
scale_color_manual(values = c("1" = "#6A0207", "2" = "#3B5708"),
labels = c("Sementes coletadas", "Fenologia")) +
scale_x_continuous(breaks = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12),
labels = c("A", "S", "Onn2022", "N", "D", "J", "F",
"Mnn 2023", "A", "M", "J", "J")) +
scale_y_discrete(labels = expression(italic("Trichilia pallida"), italic("Trichilia pallida"),
italic("Pera glabrata"), italic("Pera glabrata"),
italic("Casearia sylvestris"), italic("Casearia sylvestris"))) +
theme_minimal() +
theme(legend.position = "top",
axis.text.y = element_text(size = 12),
text = element_text(size = 14))
I tried manually changing the spacing, but it didn’t work cause I probably did it wrong.
Igor Matos Moreira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.