Skip to content

Commit 3671009

Browse files
committed
minor formatting in figure-4-plotting.R
1 parent 719c51d commit 3671009

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

R/plotting+analysis/figure-4-plotting.R

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,16 @@ IWRMclass <- reclassify(iwrm_harm, rclmat)
2424

2525
IWRMclass <- rasterToPolygons(IWRMclass, dissolve = T)
2626

27-
# Identify non-hotspots and shade on map
28-
basins_data$faderegs <- rep(NA)
29-
basins_data$faderegs[basins_data$ss_vcls < 2] <- 1
30-
basins_data_d <- basins_data %>% filter(faderegs == 1)
31-
32-
# Identify non-hotspots and shade on map
27+
# Identify non-hotspots and fade on map
3328
basins_data$hotspots <- rep(NA)
3429
basins_data$hotspots[basins_data$ss_vcls >= 2] <- 1
3530
basins_data_h <- basins_data %>% filter(hotspots == 1)
3631
basins_data_h <- fasterize(sf = basins_data_h, raster = WGS84_areaRaster(0.5))
32+
basins_data_nh <- 1 - basins_data_h
3733
basins_data_h <- raster::rasterToPolygons(basins_data_h, na.rm = T, dissolve = T)
34+
basins_data_nh[is.na(basins_data_nh)] <- 1
35+
basins_data_nh[basins_data_nh == 0] <- NA
36+
basins_data_nh <- projectRaster(basins_data_nh, crs = crs("+proj=robin"), method = 'ngb')
3837

3938
# Custom palette
4039
cus.pal <- c("#D57F31", "#E8BA24", "#81BF81", "#6CBDEF", "#0D7EB6")
@@ -44,7 +43,7 @@ tm <- tm_shape(coastlines, projection = "+proj=robin") + tm_fill(col = '#b3b3b3'
4443
tm_polygons(col = "iwrm_fill", style = "cat", palette = cus.pal,
4544
lwd = 0, colorNA = '#b3b3b3') +
4645
tm_shape(basins_data) + tm_borders(lwd = 0.2) +
47-
tm_shape(basins_data_d) + tm_fill(col = 'black', alpha = 0.5) +
46+
tm_shape(basins_data_nh) + tm_raster(style = 'cat', palette = 'white', alpha = 0.75) +
4847
tm_shape(basins_data_h) + tm_borders(col = 'black', lwd = 2) +
4948
tm_shape(coastlines) +
5049
tm_borders(lwd = 0.7, col = "black") +

0 commit comments

Comments
 (0)