stat_spoke {ggplot2} | R Documentation |
Convert angle and radius to xend and yend.
stat_spoke(mapping = NULL, data = NULL, geom = "segment", position = "identity", ...)
mapping |
The aesthetic mapping, usually constructed
with |
data |
A layer specific dataset - only needed if you want to override the plot defaults. |
geom |
The geometric object to use display the data |
position |
The position adjustment to use for overlappling points on this layer |
... |
other arguments passed on to
|
a data.frame with additional columns
xend |
x position of end of line segment |
yend |
x position of end of line segment |
stat_spoke
understands the following aesthetics (required aesthetics are in bold):
angle
radius
x
y
xend
yend
df <- expand.grid(x = 1:10, y=1:10) df$angle <- runif(100, 0, 2*pi) df$speed <- runif(100, 0, 0.5) qplot(x, y, data=df) + stat_spoke(aes(angle=angle), radius = 0.5) last_plot() + scale_y_reverse() qplot(x, y, data=df) + stat_spoke(aes(angle=angle, radius=speed))