savet ar c'hartennoù

This commit is contained in:
Ewen 2022-11-04 14:12:07 +01:00
parent db9ade0eb4
commit 74801d2ece
3 changed files with 39 additions and 19 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
data/
tmp/
res/
# ---> R

Binary file not shown.

View file

@ -20,24 +20,43 @@ source("./scripts/enporzhiañ_kartenn.R")
##############################
## Sevel ur gartenn
anv <- "Agropyron repens"
sub_data <- data %>%
filter(anv_latin==anv) %>%
tidyr::unite(., label, anv_bzg_1, anv_bzg_2, anv_bzg_3, na.rm=TRUE, sep="\n")
library(ggplot2)
library(ggrepel)
pdf(paste0("./res/", anv, ".pdf"), width=10, height=7)
p <- ggplot(data=kumuniou_poly_simple)+
geom_sf(size=0.1, color="#bfbfbf")+
ggtitle(anv)+
theme_void()+
# Anvioù
geom_label(data=sub_data, alpha=.25, color="black", aes(x=hed, y=led, label=label))+
theme(plot.title = element_text(face = "bold", hjust=0.5, size=12),
legend.position="bottom",
legend.title=element_text(size=10),
legend.key.width=unit(0.5, "inches"),
legend.key.height=unit(0.1, "inches"))
print(p)
dev.off()
for(s in unique(data$strollad)) {
#grDevices::cairo_pdf(paste0("./res/strollad_", s, ".pdf"), width=10, height=7, onefile=TRUE)
#pdf(paste0("./res/strollad_", s, ".pdf"), width=10, height=7, onefile=TRUE)
data_strollad <- data %>%
filter(strollad==s)
for(anv in unique(data_strollad$anv_latin)) {
grDevices::cairo_pdf(paste0("./res/",s, "_", anv, " (kumuniou).pdf"), width=10, height=7, onefile=TRUE)
sub_data <- data %>%
filter(anv_latin==anv) %>%
tidyr::unite(., label, anv_bzg_1, anv_bzg_2, anv_bzg_3, na.rm=TRUE, sep="\n")
p <- ggplot(data=kumuniou_poly_simple)+
geom_sf(size=0.1, color="#bfbfbf")+
ggtitle(substitute(''~italic(x), list(x=anv)))+
theme_void()+
# Pikoù
geom_point(data=sub_data, aes(x=hed, y=led))+
# Anvioù
geom_label_repel(data=sub_data, color=alpha("black", 1), hjust=0,
nudge_x=0.1, size=4,
aes(x=hed, y=led, label=label))+
# Neuz
theme(plot.title = element_text(face = "bold", hjust=0.5, size=20),
legend.position="bottom",
legend.title=element_text(size=10),
legend.key.width=unit(0.5, "inches"),
legend.key.height=unit(0.1, "inches"))
print(p)
dev.off()
}
#dev.off()
}