stat_spokestat_spoke(mapping=NULL, data=NULL, geom="segment", position="identity", ...)
Convert angle and radius to xend and yend
This page describes stat_spoke, see layer and qplot for how to create a complete plot from individual components.
What do you think of the documentation? Please let me know by filling out this short online survey.
The following aesthetics can be used with stat_spoke. Aesthetics are mapped to variables in the data with the aes function: stat_spoke(aes(x = var)). Note that you do not need quotes around the variable name.
Scales control how the variable is mapped to the aesthetic and are listed after each aesthetic.
| Aesthetic | Default | Related scales |
|---|---|---|
| x | required | continuous, date, datetime, discrete |
| y | required | continuous, date, datetime, discrete |
| angle | required | |
| radius | required | |
| xend | ..xend.. | |
| yend | ..yend.. |
Layers are divided into groups by the group aesthetic. By default this is set to the interaction of all categorical variables present in the plot.
To use these variables in an aesthetic mapping, you need to surrond them with .., like aes(x = ..output..). This tells ggplot that the variable isn't the original dataset, but has been created by the statistic.
xend, x position of end of line segmentyend, x position of end of line segmentParameters control the appearance of the stat. In addition to the parameters listed below (if any), any aesthetic can be used as a parameter, in which case it will override any aesthetic mapping.
...: ignored This function returns a layer object.
> 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))
![]()
What do you think of the documentation? Please let me know by filling out this short online survey.