geom_line_clip: Draw a rose or line_clip curve In EmilHvitfeldt/ggclipped: Add Special Case Geoms to 'ggplot2' Where Lines Overlap

Description

This geom allows you to draw the line_clip curve. A line_clip is a curve traced by a point attached to a circle of radius r_min rolling around the outside of a fixed circle of radius r_max, where the point is at a distance h from the center of the interior circle. h is the same as r_min by default.

Usage

 1 2 3 4 5 6 7 stat_line_clip(mapping = NULL, data = NULL, geom = "line_clip", position = "identity", clip_length = 0.1, show.legend = NA, inherit.aes = TRUE, ...) geom_line_clip(mapping = NULL, data = NULL, stat = "line_clip", position = "identity", clip_length = 0.1, show.legend = NA, inherit.aes = TRUE, ...) 

Arguments

 mapping Set of aesthetic mappings created by aes() or aes_(). If specified and inherit.aes = TRUE (the default), it is combined with the default mapping at the top level of the plot. You must supply mapping if there is no plot mapping. data The data to be displayed in this layer. There are three options: If NULL, the default, the data is inherited from the plot data as specified in the call to ggplot(). A data.frame, or other object, will override the plot data. All objects will be fortified to produce a data frame. See fortify() for which variables will be created. A function will be called with a single argument, the plot data. The return value must be a data.frame, and will be used as the layer data. geom The geometric object to use display the data position Position adjustment, either as a string, or the result of a call to a position adjustment function. clip_length Length of the clipped hole show.legend logical. Should this layer be included in the legends? NA, the default, includes if any aesthetics are mapped. FALSE never includes, and TRUE always includes. It can also be a named logical vector to finely select the aesthetics to display. inherit.aes If FALSE, overrides the default aesthetics, rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. borders(). ... Other arguments passed on to layer(). These are often aesthetics, used to set an aesthetic to a fixed value, like colour = "red" or size = 3. They may also be parameters to the paired geom/stat. stat The statistical transformation to use on the data for this layer, as a string.

Details

To unscale the curve, please set xscale and yscale to r_max + r_min + h.

The curve follows the the parameterized form

x = (r_max + r_min) cos(θ) - h * cos(\frac{r_max + r_min}{r_min} θ)

x = (r_max + r_min) sin(θ) - h * sin(\frac{r_max + r_min}{r_min} θ)

these curves are closed when the radion a / b is rational. delta have been scaled to be in the interval [0, 1].

Aesthetics

geom_arc understand the following aesthetics (required aesthetics are in bold):

- **r_max** - **r_min** - h - x0 - y0 - xscale - yscale - rotation - color - fill - size - linetype - alpha - lineend

Computed variables

x, y

The coordinates for the points along the rose curve

Emil Hvitfeldt

Examples

 1 2 3 4 5 6 7 library(ggplot2) data <- data.frame(rank = rep(0:1, 5), time = rep(1:5, 2), team = rep(0:1, each = 5)) ggplot(data, aes(time, rank, color = factor(team))) + geom_line_clip(size = 2, clip_length = 0.05) 

EmilHvitfeldt/ggclipped documentation built on May 11, 2019, 3:09 p.m.