View source: R/canvas_function.R
canvas_function | R Documentation |
This function paints functions with random parameters on a canvas.
canvas_function(
colors,
background = "#fafafa",
by = 0.01,
polar = TRUE,
formula = NULL
)
colors |
a string specifying the color used for the artwork. |
background |
a character specifying the color used for the background. |
by |
a value specifying the step size between consecutive points. |
polar |
logical. Whether to draw the function with polar coordinates. |
formula |
optional, a named list with 'x' and 'y' as structured in the example. If |
A ggplot
object containing the artwork.
Koen Derks, koen-derks@hotmail.com
https://github.com/cutterkom/generativeart
colorPalette
set.seed(10)
# Simple example
canvas_function(colors = colorPalette("tuscany1"))
# Advanced example
formula <- list(
x = quote(x_i^2 - sin(y_i^2)),
y = quote(y_i^3 - cos(x_i^2))
)
canvas_function(colors = "firebrick", formula = formula)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.