ShadeR provide a new geom for ggplot2, geom_fleck, to make dot density plots and an associated stat, aspect_shading, to generate shadding effect.
ShadeR is inspired by this post of Elio Campitelli and relies on his package metR for the computation of derivatives.
These two packages can be installed with the following comamands:
# install.packages("devtools")
devtools::install_github("eliocamp/metR")
# And intsallation of ShadeR:
devtools::install_github("Clement-Viguier/ShadeR")
An example of The Andes relief and Pacific Ocean ploted with geom_fleck and stat_aspect_shading: Like any geom_similar to point, geom_fleck accepts changes of aes like colour, used here to distinguish the ocean from the land.
THe resolution can be given as an aesthetic or is computed if
res = NULL
in the geom_fleck call.
Another aesthetic is * sun.angle * that modify the position of the sun for the shading computation by stat functions (only stat_aspect_shading for now). Below it is used with image_animate:
Three one-line examples you can try once ShadeR is installed:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.