Learn R Programming

ggplot2 (version 0.9.2.1)

stat_spoke: Convert angle and radius to xend and yend.

Description

Convert angle and radius to xend and yend.

Usage

stat_spoke(mapping = NULL, data = NULL, geom = "segment",
    position = "identity", ...)

Arguments

mapping
The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defaults.
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 layer. This can include aesthetics whose values you want to set, not map. See layer for more details.

Value

  • a data.frame with additional columns
  • xendx position of end of line segment
  • yendx position of end of line segment

Aesthetics

[results=rd,stage=build]{ggplot2:::rd_aesthetics("stat", "spoke")} 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))