Description Usage Arguments Details Aesthetics Computed variables Author(s) References Examples
This geom allows you to draw mathematical roses. A rose is a sinusoid plotted in polar coordinates.
1 2 3 4 5 6 7 | stat_rose(mapping = NULL, data = NULL, geom = "rose",
position = "identity", n_points = 360, na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE, ...)
geom_rose(mapping = NULL, data = NULL, stat = "rose",
position = "identity", n_points = 360, na.rm = FALSE,
show.legend = NA, inherit.aes = TRUE, ...)
|
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
geom |
The geometric object to use display the data |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
n_points |
The number of points to sample along the curve. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
... |
Other arguments passed on to |
stat |
The statistical transformation to use on the data for this layer, as a string. |
the shape follows the following parameterized form
x = (cos(kθ) + c)cos(θ)
y = (cos(kθ) + c)sin(θ)
where
k = n / d
the rose will be a closed loop when k is rational. this can easily be achived by keeping n and d whole numbers. c is the internal offset parameter changing how much the flower spreads out.
geom_arc understand the following aesthetics (required aesthetics are in bold):
- **n** - **d** - **c** - x0 - y0 - xscale - yscale - rotation - color - fill - size - linetype - alpha - lineend
The coordinates for the points along the rose curve
Emil Hvitfeldt
https://en.wikipedia.org/wiki/Rose_(mathematics)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ggplot() +
geom_rose(aes(n = 2, d = 1, c = 0))
ggplot() +
geom_rose(aes(n = 2, d = 8, c = 0))
ggplot() +
geom_rose(aes(n = 5, d = 4, c = 4))
# Rescaling
ggplot() +
geom_rose(aes(n = 5, d = 4, c = 4, xscale = 6, yscale = 2))
# Rotation
ggplot() +
geom_rose(aes(n = 2, d = 1, c = 0, rotation = pi / 4))
# Multiple roses
ggplot() +
geom_rose(aes(n = 5:1, d = 1:5, c = 0, x0 = 1:5 * 3))
ggplot() +
geom_rose(aes(n = 5, d = 4, c = 4), fill = "white")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.