Mercurial > repos > ecology > ecoregion_taxa_seeker
diff crea_carte_G.R @ 0:e3cd588fd14a draft
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/Ecoregionalization_workflow commit 2a2ae892fa2dbc1eff9c6a59c3ad8f3c27c1c78d
author | ecology |
---|---|
date | Wed, 18 Oct 2023 09:58:17 +0000 |
parents | |
children | 9dc992f80c25 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/crea_carte_G.R Wed Oct 18 09:58:17 2023 +0000 @@ -0,0 +1,38 @@ +#Author : Seguineau Pauline + + +#Create a map from cluster + +library(sf) +library(tmap) +library(dplyr) + +args = commandArgs(trailingOnly=TRUE) +if (length(args)==0) +{ + stop("This tool needs at least one argument") +}else{ + data <- args[1] +} + +clus <- read.table(data, header=TRUE, na.strings = "na") + +#tmap method + +sf_data <- st_as_sf(clus, coords = c("long", "lat"), crs =4326) + +grouped_data <- sf_data %>% + group_by(cluster) %>% + summarize() + +map <- tm_shape(grouped_data) + + tm_dots(col = "cluster", palette = "Accent", size = 0.1, title = "écorégions")+ + tm_scale_bar(position = c("right","top"))+ + tm_compass(position = c("right","top"))+ + tm_layout(frame = FALSE,legend.position = c("left","bottom"))+ + tm_xlab("Longitude")+ + tm_ylab("Latitude")+ + tm_grid(alpha = 0.2) + +#Save the map +tmap_save(map, "ecoregions.png")