with_dither | R Documentation |
This filter reduces the number of colours in your layer and uses the Floyd-Steinberg algorithm to even out the error introduced by the colour reduction.
with_dither(x, max_colours = 256, colourspace = "sRGB", ...)
x |
A ggplot2 layer object, a ggplot, a grob, or a character string naming a filter |
max_colours |
The maximum number of colours to use. The result may contain fewer colours but never more. |
colourspace |
In which colourspace should the dithering be calculated |
... |
Arguments to be passed on to methods. See the documentation of supported object for a description of object specific arguments. |
Depending on the input, either a grob
, Layer
, list of Layer
s,
guide
, or element
object. Assume the output can be used in the same
context as the input.
Other dithering filters:
with_circle_dither()
library(ggplot2) ggplot(faithfuld, aes(waiting, eruptions)) + with_dither( geom_raster(aes(fill = density), interpolate = TRUE), max_colours = 10 ) + scale_fill_continuous(type = 'viridis')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.