canvas_diamonds: Draw Diamonds
Description
This function draws diamonds on a canvas and (optionally) places two lines behind them. The diamonds can be transparent or have a random color sampled from the input.
Usage
canvas_diamonds(
colors,
background = "#fafafa",
col.line = "black",
radius = 10,
alpha = 1,
p = 0.2,
resolution = 500
)
Value
A ggplot
object containing the artwork.
Arguments
- colors
a string or character vector specifying the color(s) used for the artwork.
- background
a character specifying the color used for the background.
- col.line
a character specifying the color of the diamond borders.
- radius
a positive value specifying the radius of the diamonds.
- alpha
a value specifying the transparency of the diamonds. If NULL
(the default), added layers become increasingly more transparent.
- p
a value specifying the probability of drawing an empty diamond.
- resolution
resolution of the artwork in pixels per row/column. Increasing the resolution increases the quality of the artwork but also increases the computation time exponentially.
Examples
Run this code# \donttest{
set.seed(1)
# Simple example
canvas_diamonds(colors = colorPalette("tuscany1"))
# }
Run the code above in your browser using DataLab