stat_spoke {ggplot2}R Documentation

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

xend

x position of end of line segment

yend

x position of end of line segment

Aesthetics

stat_spoke understands the following aesthetics (required aesthetics are in bold):

Examples

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))

[Package ggplot2 version 0.9.3.1 Index]