It draws fuzzy rectangles.
Usage
xkcdrect(
mapping,
data,
...,
fillcolour = "grey90",
bordercolour = "black",
borderlinewidth = 0.5,
borderxjitteramount = 0.005,
borderyjitteramount = 0.005
)Arguments
- mapping
Mapping between variables and aesthetics generated by
aes. See Details.- data
Dataset used in this layer.
- ...
Optional arguments.
- fillcolour
The fill colour of the rectangle.
- bordercolour
The colour of the fuzzy border lines.
- borderlinewidth
The thickness of the fuzzy border lines. This is the package's implementation of the
linewidthaesthetic.- borderxjitteramount
Horizontal jitter amount for the border.
- borderyjitteramount
Vertical jitter amount for the border.
Details
This function draws fuzzy rectangles.
It plots rectangles. The following aesthetics are required:
xmin
ymin
xmax
ymax
Additionally, you can use the aesthetics of geom_path and geom_rect.
Examples
if (FALSE) { # \dontrun{
volunteers <- data.frame(year = c(2007:2011),
number = c(56470, 56998, 59686, 61783, 64251))
xrange <- range(volunteers$year)
yrange <- range(volunteers$number)
p <- ggplot() +
xkcdrect(aes(xmin = year - 0.2,
xmax = year + 0.2,
ymin = number - 500,
ymax = number + 500),
data = volunteers,
fillcolour = "pink",
borderlinewidth = 1.2) +
geom_point(aes(x = year, y = number), data = volunteers) +
xkcdaxis(xrange, yrange) +
theme_xkcd()
p
} # }