geom_spoke | R Documentation |
This is a polar parameterisation of geom_segment()
. It is
useful when you have variables that describe direction and distance.
The angles start from east and increase counterclockwise.
geom_spoke(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
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 |
stat |
The statistical transformation to use on the data for this layer.
When using a
|
position |
A position adjustment to use on the data for this layer. This
can be used in various ways, including to prevent overplotting and
improving the display. The
|
... |
Other arguments passed on to
|
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom_spoke()
understands the following aesthetics (required aesthetics are in bold):
x
y
angle
radius
alpha
colour
group
linetype
linewidth
Learn more about setting these aesthetics in vignette("ggplot2-specs")
.
df <- expand.grid(x = 1:10, y=1:10)
set.seed(1)
df$angle <- runif(100, 0, 2*pi)
df$speed <- runif(100, 0, sqrt(0.1 * df$x))
ggplot(df, aes(x, y)) +
geom_point() +
geom_spoke(aes(angle = angle), radius = 0.5)
ggplot(df, aes(x, y)) +
geom_point() +
geom_spoke(aes(angle = angle, radius = speed))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.