geom_spiro | R Documentation |
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.
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 to display the data, either as a
|
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
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, either as a |
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
# 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.