Hillshade, colors and marginal plots with tidyterra (I) | One world #36
Replies: 3 comments 5 replies
-
|
Hola Diego! Thanks a lot for the tutorial! I am trying to incorporate the use of tidyterra into my workflow, and I am trying to add some elevation hillshade into my maps. I can do it with base R and terra (using the example functions from the terra documentation) but I have already a set of layers in my maps using ggplot2. So I wanted to add the hillshade as a ggplot layer. I tried your method here, but my computer seems to run out of memory when resampling the elevation raster for the colour scale here: # Use a vector of colors
index <- hill %>%
mutate(index_col = rescale(shades, to = c(1, length(pal_greys)))) %>%
mutate(index_col = round(index_col)) %>%
pull(index_col)
# Error: std::bad_allocI am trying a few other options: like using the |
Beta Was this translation helpful? Give feedback.
-
|
@dieghernan gracias! So I tried this approach: So it runs nicely, but honestly, I don't see the difference "visually", or it is very subtle. Unless maybe I increase the transparency a lot (reduce the alpha) of my layer of interest, which may "water down" my actual purpose (to show my raster). Anyway, I will keep playing with the function, and may bug rhijmans for some other issue with the shade function soon! Cheers! and thanks again! |
Beta Was this translation helpful? Give feedback.
-
|
Hi! Would you know how to plot "no data values" in a color different than those in the colour scheme? |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hillshade, colors and marginal plots with tidyterra (I) | One world
How to overlay SpatRasters - Using shadow effects on relief mappings is a very common technique, that allows to produce informative yet beautiful maps.
https://dieghernan.github.io/202210_tidyterra-hillshade/
Beta Was this translation helpful? Give feedback.
All reactions