R/circle_dither.R
, R/custom_dither.R
, R/halftone_dither.R
, and 1 more
with_ordered_dither.Rd
These filters reduces the number of colours in your layer and uses various threshold maps along with a dithering algorithm to disperse colour error.
with_circle_dither(
x,
map_size = 7,
levels = NULL,
black = TRUE,
colourspace = "sRGB",
offset = NULL,
...
)
with_custom_dither(
x,
map = "checks",
levels = NULL,
colourspace = "sRGB",
offset = NULL,
...
)
with_halftone_dither(
x,
map_size = 8,
levels = NULL,
angled = TRUE,
colourspace = "sRGB",
offset = NULL,
...
)
with_ordered_dither(x, map_size = 8, levels = NULL, colourspace = "sRGB", ...)
A ggplot2 layer object, a ggplot, a grob, or a character string naming a filter
One of 2, 3, 4, or 8. Sets the threshold map used for dithering. The larger, the better approximation of the input colours
The number of threshold levels in each channel. Either a single integer to set the same number of levels in each channel, or 3 values to set the levels individually for each colour channel
Should the map consist of dark circles expanding into the light, or the reverse
In which colourspace should the dithering be calculated
The angle offset between the colour channels
Arguments to be passed on to methods. See the documentation of supported object for a description of object specific arguments.
The name of the threshold map to use as understood by
magick::image_ordered_dither()
Should the halftone pattern be at an angle or orthogonal
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_dither()
library(ggplot2)
# Ordered dither
ggplot(faithfuld, aes(waiting, eruptions)) +
with_ordered_dither(
geom_raster(aes(fill = density), interpolate = TRUE)
) +
scale_fill_continuous(type = 'viridis')
# Halftone dither
ggplot(faithfuld, aes(waiting, eruptions)) +
with_halftone_dither(
geom_raster(aes(fill = density), interpolate = TRUE)
) +
scale_fill_continuous(type = 'viridis')
# Circle dither with offset
ggplot(faithfuld, aes(waiting, eruptions)) +
with_circle_dither(
geom_raster(aes(fill = density), interpolate = TRUE),
offset = 29,
colourspace = 'cmyk'
) +
scale_fill_continuous(type = 'viridis')