Description Usage Arguments Aesthetics Computed variables Author(s) Examples
This, rather pointless, geom allows you to draw spirograms, as known from the popular drawing toy where lines were traced by inserting a pencil into a hole in a small gear that would then trace around inside another gear. The potential practicality of this geom is slim and it excists mainly for fun and art.
1 2 3 4 5 6 7 | stat_spiro(mapping = NULL, data = NULL, geom = "path",
position = "identity", na.rm = FALSE, n = 500, revolutions = NULL,
show.legend = NA, inherit.aes = TRUE, ...)
geom_spiro(mapping = NULL, data = NULL, stat = "spiro",
position = "identity", arrow = NULL, n = 500, lineend = "butt",
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. |
na.rm |
If |
n |
The number of points that should be used to draw a fully closed
spirogram. If |
revolutions |
The number of times the inner gear should revolve around
inside the outer gear. 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. |
arrow |
Arrow specification, as created by |
lineend |
Line end style (round, butt, square) |
stat_spiro and geom_spiro understand the following aesthetics (required aesthetics are in bold):
R
r
d
x0
y0
outer
color
size
linetype
alpha
The coordinates for the path describing the spirogram
The progression along the spirogram mapped between 0 and 1
Thomas Lin Pedersen
1 2 3 4 5 6 7 8 9 10 11 | # Basic usage
ggplot() +
geom_spiro(aes(R = 10, r = 3, d = 5))
# Only draw a portion
ggplot() +
geom_spiro(aes(R = 10, r = 3, d = 5), revolutions = 1.2)
# Let the inner gear circle the outside of the outer gear
ggplot() +
geom_spiro(aes(R = 10, r = 3, d = 5, outer = TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.