Skip to content
Snippets Groups Projects
Commit 48314be8 authored by Francesco Sabatini's avatar Francesco Sabatini
Browse files

Added DEM to graphs showing position of strange plots (elevation < -100)

parent ef0e0244
Branches
No related tags found
No related merge requests found
......@@ -38,7 +38,8 @@ library(viridis)
library(grid)
library(gridExtra)
library(ggforce)
library(viridis)
library(ggrepel)
```
......@@ -235,7 +236,7 @@ summary(elevation.out)
```
There are `r sum(elevation.out$elevation < -100)` plots with elevation < 100 !
There are `r sum(elevation.out$elevation < -100, na.rm=T)` plots with elevation < -100 !
Check strange values (elevation < -100 m.s.l.)
......@@ -271,16 +272,27 @@ strange <- strange %>%
for(i in 1:nlevels(strange$tilenam)){
strange.i <- strange %>%
filter(tilenam==levels(strange$tilenam)[i])
sp.i <- SpatialPoints(coords=strange.i %>%
dplyr::select(Longitude, Latitude),
proj4string = CRS("+init=epsg:4326"))
dem.i <- get_elev_raster(sp.i, z=10)
dem.df <- data.frame(xyFromCell(dem.i, cell=1:ncell(dem.i)), z=getValues(dem.i))
ggstrange <- ggplot(countries, aes(x=long, y=lat, group = group)) +
geom_polygon(col=gray(0.3), lwd=0.3, fill = gray(0.9)) +
geom_tile(data=dem.df, aes(x=x, y=y, colour=z, group=1)) +
geom_polygon(col=gray(0.3), lwd=0.3, fill = gray(0.9), alpha=1/5) +
geom_point(data=strange.i,
aes(x=Longitude, y=Latitude, group=1), col=2)+
aes(x=Longitude, y=Latitude, group=1), col="red")+
coord_equal(xlim= robust.range(strange.i$Longitude),
ylim= robust.range(strange.i$Latitude)) +
geom_label(data=strange.i,
geom_label_repel(data=strange.i,
aes(x=Longitude, y=Latitude, group=1,
label=strange.i$PlotObservationID),
nudge_y = 0.5)
box.padding = 0.35,
point.padding = 0.5,
segment.color = 'grey50') +
scale_color_viridis() +
theme_bw() +
theme(axis.title = element_blank())
print(ggstrange)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment