Skip to content

Commit

Permalink
Update make_ecoregion_help.R
Browse files Browse the repository at this point in the history
  • Loading branch information
8Ginette8 authored Feb 10, 2025
1 parent ab9ddc7 commit d4671a4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions inst/examples/make_ecoregion_help.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rst <- terra::crop(rst, shp.lonlat)

# Apply the function by infering 50 classes of environments
my.eco <- make_ecoregion(env = rst,
nclass = 50)
nclass = 50)

# Test plot
col_palette = colorRampPalette(c("#a6cee3", "#1f78b4", "#b2df8a", "#33a02c",
Expand All @@ -19,18 +19,18 @@ terra::plot(my.eco, col = my.eco$color)

# Downloading in the European Alps the observations of one plant species
obs.arcto <- get_gbif(sp_name = "Arctostaphylos alpinus",
geo = shp.lonlat)
geo = shp.lonlat)

# Create the range map based on our custom ecoregion
range.arcto <- get_range(occ_coord = obs.arcto,
bioreg = my.eco,
bioreg_name = "EcoRegion",
res = 20)
bioreg = my.eco,
bioreg_name = "EcoRegion",
res = 20)

# Plot
countries <- rnaturalearth::ne_countries(type = "countries", returnclass = "sv")
terra::plot(terra::crop(countries,terra::ext(rst)), col = "#bcbddc")
terra::plot(range.arcto$rangeOutput,add = TRUE,
col = "darkgreen", axes = FALSE, legend = FALSE)
graphics::points(obs.arcto[, c("decimalLongitude","decimalLatitude")],
pch = 20, col = "#99340470", cex= 1)
pch = 20, col = "#99340470", cex= 1)

0 comments on commit d4671a4

Please sign in to comment.