Learn R Programming

aRtsy (version 0.2.4)

canvas_mosaic: Draw Moisaics

Description

This function draws the predictions from a k-nearest neighbors algorithm trained on randomly generated categorical data.

Usage

canvas_mosaic(
  colors,
  n = 1000,
  resolution = 500
)

Value

A ggplot object containing the artwork.

Arguments

colors

a string or character vector specifying the color(s) used for the artwork.

n

a positive integer specifying the number of random data points to generate.

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.

Author

Koen Derks, koen-derks@hotmail.com

References

https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm

See Also

colorPalette

Examples

Run this code
# \donttest{
set.seed(1)

# Simple example
canvas_mosaic(colors = colorPalette("retro2"))
# }

Run the code above in your browser using DataLab