element_paper() is a rectangle with the fine tooth of watercolor paper.
It can be used wherever a theme takes ggplot2::element_rect(), and is
meant for plot.background, where it covers the whole page.
theme_paper() uses it when its texture argument is above 0.
Usage
element_paper(
fill = NULL,
colour = NULL,
texture = 0.05,
grain_size = 0.35,
dpi = 200,
seed = 1,
...
)Arguments
- fill
Colour of the paper.
- colour
Colour of the border. Use
NAfor no border.- texture
Strength of the texture, as the largest proportional change in the brightness of the paper.
- grain_size
Approximate size of the tooth, in millimetres.
- dpi
Resolution of the texture, in cells per inch.
- seed
A single integer that fixes the pattern of the texture.
- ...
Other arguments passed on to
ggplot2::element_rect().
Details
ggwatercolor computes the texture when the device draws the plot, so
grain_size is a length on the page. The result is a raster image.
Examples
library(ggplot2)
ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme(
plot.background = element_paper(fill = "#E8E2D0", texture = 0.1),
panel.background = element_blank()
)