comparison crea_carte_G.R @ 1:edb8d19735a6 draft

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/Ecoregionalization_workflow commit 459ba1277acd7d8d4a02f90dbd7ff444bf8eac92
author ecology
date Wed, 24 Jan 2024 15:53:07 +0000
parents 32849c52aa54
children
comparison
equal deleted inserted replaced
0:32849c52aa54 1:edb8d19735a6
13 stop("This tool needs at least one argument") 13 stop("This tool needs at least one argument")
14 }else{ 14 }else{
15 data <- args[1] 15 data <- args[1]
16 } 16 }
17 17
18 clus <- read.table(data, header=TRUE, na.strings = "na") 18 clus <- read.table(data, sep="\t" ,header=TRUE, na.strings = "na")
19 19
20 #tmap method 20 #tmap method
21 21
22 sf_data <- st_as_sf(clus, coords = c("long", "lat"), crs =4326) 22 sf_data <- st_as_sf(clus, coords = c("long", "lat"), crs =4326)
23 23
24 grouped_data <- sf_data %>% 24 grouped_data <- sf_data %>%
25 group_by(cluster) %>% 25 group_by(cluster) %>%
26 summarize() 26 summarize()
27 27
28 map <- tm_shape(grouped_data) + 28 map <- tm_shape(grouped_data) +
29 tm_dots(col = "cluster", palette = "Accent", size = 0.1, title = "écorégions")+ 29 tm_dots(col = "cluster", palette = "Accent", n=256, size = 0.1, title = "ecoregions")+
30 tm_scale_bar(position = c("right","top"))+ 30 tm_scale_bar(position = c("right","top"))+
31 tm_compass(position = c("right","top"))+ 31 tm_compass(position = c("right","top"))+
32 tm_layout(frame = FALSE,legend.position = c("left","bottom"))+ 32 tm_layout(frame = FALSE,legend.position = c("left","bottom"))+
33 tm_xlab("Longitude")+ 33 tm_xlab("Longitude")+
34 tm_ylab("Latitude")+ 34 tm_ylab("Latitude")+