ggforce/ 0000755 0001762 0000144 00000000000 14564632262 011700 5 ustar ligges users ggforce/NAMESPACE 0000644 0001762 0000144 00000013511 14564603246 013120 0 ustar ligges users # Generated by roxygen2: do not edit by hand
S3method(heightDetails,mark_label)
S3method(makeContent,circ_enc)
S3method(makeContent,ellip_enc)
S3method(makeContent,hull_enc)
S3method(makeContent,rect_enc)
S3method(makeContent,shape)
S3method(single_val,default)
S3method(single_val,factor)
S3method(widthDetails,mark_label)
export(FacetCol)
export(FacetGridPaginate)
export(FacetMatrix)
export(FacetRow)
export(FacetStereo)
export(FacetWrapPaginate)
export(FacetZoom)
export(GeomArc)
export(GeomArc0)
export(GeomArcBar)
export(GeomAutoarea)
export(GeomAutorect)
export(GeomBezier0)
export(GeomBspline0)
export(GeomBsplineClosed0)
export(GeomCircle)
export(GeomMarkCircle)
export(GeomMarkEllipse)
export(GeomMarkHull)
export(GeomMarkRect)
export(GeomParallelSetsAxes)
export(GeomShape)
export(PositionAuto)
export(PositionFloatstack)
export(PositionJitterNormal)
export(StatArc)
export(StatArc0)
export(StatArc2)
export(StatArcBar)
export(StatAutobin)
export(StatAutodensity)
export(StatBezier)
export(StatBezier0)
export(StatBezier2)
export(StatBspline)
export(StatBspline2)
export(StatCircle)
export(StatDelaunaySegment)
export(StatDelaunaySegment2)
export(StatDelaunayTile)
export(StatDelvorSummary)
export(StatDiagonal)
export(StatDiagonal0)
export(StatDiagonal2)
export(StatDiagonalWide)
export(StatEllip)
export(StatErr)
export(StatLink)
export(StatLink2)
export(StatParallelSets)
export(StatParallelSetsAxes)
export(StatPie)
export(StatRegon)
export(StatSina)
export(StatSpiro)
export(StatVoronoiSegment)
export(StatVoronoiTile)
export(facet_col)
export(facet_grid_paginate)
export(facet_matrix)
export(facet_row)
export(facet_stereo)
export(facet_wrap_paginate)
export(facet_zoom)
export(gather_set_data)
export(geom_arc)
export(geom_arc0)
export(geom_arc2)
export(geom_arc_bar)
export(geom_autodensity)
export(geom_autohistogram)
export(geom_autopoint)
export(geom_bezier)
export(geom_bezier0)
export(geom_bezier2)
export(geom_bspline)
export(geom_bspline0)
export(geom_bspline2)
export(geom_bspline_closed)
export(geom_bspline_closed0)
export(geom_circle)
export(geom_delaunay_segment)
export(geom_delaunay_segment2)
export(geom_delaunay_tile)
export(geom_diagonal)
export(geom_diagonal0)
export(geom_diagonal2)
export(geom_diagonal_wide)
export(geom_ellipse)
export(geom_link)
export(geom_link0)
export(geom_link2)
export(geom_mark_circle)
export(geom_mark_ellipse)
export(geom_mark_hull)
export(geom_mark_rect)
export(geom_parallel_sets)
export(geom_parallel_sets_axes)
export(geom_parallel_sets_labels)
export(geom_regon)
export(geom_shape)
export(geom_sina)
export(geom_spiro)
export(geom_voronoi_segment)
export(geom_voronoi_tile)
export(interpolateDataFrame)
export(label_tex)
export(linear_trans)
export(n_pages)
export(position_auto)
export(position_jitternormal)
export(power_trans)
export(radial_trans)
export(scale_depth)
export(scale_depth_continuous)
export(scale_depth_discrete)
export(scale_x_unit)
export(scale_y_unit)
export(stat_arc)
export(stat_arc0)
export(stat_arc2)
export(stat_arc_bar)
export(stat_bezier)
export(stat_bezier0)
export(stat_bezier2)
export(stat_bspline)
export(stat_bspline0)
export(stat_bspline2)
export(stat_bspline_closed)
export(stat_circle)
export(stat_delvor_summary)
export(stat_diagonal)
export(stat_diagonal0)
export(stat_diagonal2)
export(stat_diagonal_wide)
export(stat_ellip)
export(stat_err)
export(stat_link)
export(stat_link2)
export(stat_parallel_sets)
export(stat_parallel_sets_axes)
export(stat_pie)
export(stat_regon)
export(stat_sina)
export(stat_spiro)
export(theme_no_axes)
export(trans_reverser)
import(ggplot2)
import(rlang)
import(vctrs)
importFrom(MASS,fractions)
importFrom(Rcpp,sourceCpp)
importFrom(ggplot2,label_parsed)
importFrom(ggplot2,layer)
importFrom(grDevices,chull)
importFrom(grid,addGrob)
importFrom(grid,arcCurvature)
importFrom(grid,bezierGrob)
importFrom(grid,childNames)
importFrom(grid,convertHeight)
importFrom(grid,convertUnit)
importFrom(grid,convertWidth)
importFrom(grid,convertX)
importFrom(grid,convertY)
importFrom(grid,curveGrob)
importFrom(grid,gList)
importFrom(grid,gTree)
importFrom(grid,gpar)
importFrom(grid,grid.layout)
importFrom(grid,grob)
importFrom(grid,grobDescent)
importFrom(grid,grobHeight)
importFrom(grid,grobTree)
importFrom(grid,grobWidth)
importFrom(grid,heightDetails)
importFrom(grid,is.unit)
importFrom(grid,makeContent)
importFrom(grid,nullGrob)
importFrom(grid,polygonGrob)
importFrom(grid,polylineGrob)
importFrom(grid,rectGrob)
importFrom(grid,segmentsGrob)
importFrom(grid,setChildren)
importFrom(grid,textGrob)
importFrom(grid,unit)
importFrom(grid,unit.c)
importFrom(grid,valid.just)
importFrom(grid,viewport)
importFrom(grid,widthDetails)
importFrom(grid,xsplineGrob)
importFrom(gtable,gtable)
importFrom(gtable,gtable_add_cols)
importFrom(gtable,gtable_add_grob)
importFrom(gtable,gtable_add_rows)
importFrom(lifecycle,deprecated)
importFrom(polyclip,polyclip)
importFrom(polyclip,polylineoffset)
importFrom(polyclip,polyminkowski)
importFrom(polyclip,polyoffset)
importFrom(scales,as.trans)
importFrom(scales,asn_trans)
importFrom(scales,atanh_trans)
importFrom(scales,boxcox_trans)
importFrom(scales,censor)
importFrom(scales,date_trans)
importFrom(scales,exp_trans)
importFrom(scales,extended_breaks)
importFrom(scales,format_format)
importFrom(scales,identity_trans)
importFrom(scales,log10_trans)
importFrom(scales,log1p_trans)
importFrom(scales,log2_trans)
importFrom(scales,log_trans)
importFrom(scales,logit_trans)
importFrom(scales,probability_trans)
importFrom(scales,probit_trans)
importFrom(scales,reciprocal_trans)
importFrom(scales,rescale)
importFrom(scales,rescale_pal)
importFrom(scales,reverse_trans)
importFrom(scales,sqrt_trans)
importFrom(scales,time_trans)
importFrom(scales,trans_new)
importFrom(stats,na.omit)
importFrom(stats,runif)
importFrom(stats,setNames)
importFrom(tidyselect,eval_select)
importFrom(tweenr,tween_t)
importFrom(utils,packageVersion)
importFrom(withr,with_seed)
useDynLib(ggforce)
ggforce/LICENSE 0000644 0001762 0000144 00000000061 13437570076 012704 0 ustar ligges users YEAR: 2019
COPYRIGHT HOLDER: Thomas Lin Pedersen
ggforce/README.md 0000644 0001762 0000144 00000004743 14556450144 013165 0 ustar ligges users
# ggforce
[](https://github.com/thomasp85/ggforce/actions/workflows/R-CMD-check.yaml)
[](https://CRAN.R-project.org/package=ggforce)
[](https://CRAN.R-project.org/package=ggforce)
*Accelerating ggplot2*
`ggforce` is a package aimed at providing missing functionality to
`ggplot2` through the extension system introduced with `ggplot2` v2.0.0.
Broadly speaking `ggplot2` has been aimed primarily at explorative data
visualization in order to investigate the data at hand, and less at
providing utilities for composing custom plots a la
[D3.js](https://d3js.org). `ggforce` is mainly an attempt to address
these “shortcomings” (design choices might be a better description). The
goal is to provide a repository of geoms, stats, etc. that are as well
documented and implemented as the official ones found in `ggplot2`.
## Installation
You can install the released version of ggforce from
[CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("ggforce")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("thomasp85/ggforce")
```
## Features
`ggforce` is by design a collection of features with the only
commonality being their tie to the `ggplot2` API. Because of this an
overview of all features would get too long for a README. The package
has a [website](https://ggforce.data-imaginist.com) where every feature
is described and justified with examples and plots. There should be a
plot in the README of a visualization package though, so without further
ado:
``` r
library(ggforce)
#> Loading required package: ggplot2
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(x = Species == "versicolor")
```
## Code of Conduct
Please note that the ‘ggforce’ project is released with a [Contributor
Code of
Conduct](https://ggforce.data-imaginist.com/CODE_OF_CONDUCT.html). By
contributing to this project, you agree to abide by its terms.
ggforce/man/ 0000755 0001762 0000144 00000000000 14564603713 012452 5 ustar ligges users ggforce/man/radial_trans.Rd 0000644 0001762 0000144 00000005031 13674074434 015406 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trans.R
\name{radial_trans}
\alias{radial_trans}
\title{Create radial data in a cartesian coordinate system}
\usage{
radial_trans(r.range, a.range, offset = pi/2, pad = 0.5, clip = FALSE)
}
\arguments{
\item{r.range}{The range in radius that correspond to 0 - 1 in the unit
circle.}
\item{a.range}{The range in angles that correspond to 2*pi - 0. As radians
are normally measured counterclockwise while radial displays are read
clockwise it's an inverse mapping}
\item{offset}{The offset in angles to apply. Determines that start position
on the circle. pi/2 (the default) corresponds to 12 o'clock.}
\item{pad}{Adds to the end points of the angle range in order to separate the
start and end point. Defaults to 0.5}
\item{clip}{Should input data be clipped to r.range and a.range or be allowed
to extend beyond. Defaults to FALSE (no clipping)}
}
\value{
A trans object. The transform method for the object takes an r
(radius) and a (angle) argument and returns a data.frame with x and y columns
with rows for each element in r/a. The inverse method takes an x and y
argument and returns a data.frame with r and a columns and rows for each
element in x/y.
}
\description{
This function creates a trans object that converts radial data to their
corresponding coordinates in cartesian space. The trans object is created for
a specific radius and angle range that will be mapped to the unit circle so
data doesn't have to be normalized to 0-1 and 0-2*pi in advance. While there
exists a clear mapping from radial to cartesian, the inverse is not true as
radial representation is periodic. It is impossible to know how many
revolutions around the unit circle a point has taken from reading its
coordinates. The inverse function will always assume that coordinates are in
their first revolution i.e. map them back within the range of a.range.
}
\note{
While trans objects are often used to modify scales in ggplot2, radial
transformation is different as it is a coordinate transformation and takes
two arguments. Consider it a trans version of coord_polar and use it to
transform your data prior to plotting.
}
\examples{
# Some data in radial form
rad <- data.frame(r = seq(1, 10, by = 0.1), a = seq(1, 10, by = 0.1))
# Create a transformation
radial <- radial_trans(c(0, 1), c(0, 5))
# Get data in x, y
cart <- radial$transform(rad$r, rad$a)
# Have a look
ggplot() +
geom_path(aes(x = x, y = y), data = cart, color = 'forestgreen') +
geom_path(aes(x = r, y = a), data = rad, color = 'firebrick')
}
ggforce/man/stat_err.Rd 0000644 0001762 0000144 00000006740 14303120026 014551 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/errorbar.R
\name{stat_err}
\alias{stat_err}
\title{Intervals in vertical and horizontal directions}
\usage{
stat_err(
mapping = NULL,
data = NULL,
geom = "segment",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
}
\description{
\code{stat_err} draws intervals of points (\code{x}, \code{y}) in vertical (\code{ymin}, \code{ymax})
and horizontal (\code{xmin}, \code{xmax}) directions.
}
\section{Aesthetics}{
\code{stat_err()} understands the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x}
\item \strong{xmin}
\item \strong{xmax}
\item \strong{y}
\item \strong{ymin}
\item \strong{ymax}
\item alpha
\item color
\item group
\item linetype
\item linewidth
}
}
\examples{
library(ggplot2)
x <- 1:3
xmin <- x - 2.5
xmax <- x + 2.5
d <- data.frame(
x = x, y = x, xmin = xmin, ymin = xmin, xmax = xmax, ymax = xmax,
color = as.factor(x)
)
ggplot(
d,
aes(x = x, y = y, xmin = xmin, xmax = xmax, ymin = ymin, ymax = ymax, color = color)
) +
stat_err(size = 2)
}
ggforce/man/label_tex.Rd 0000644 0001762 0000144 00000002111 14277137746 014704 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/labeller.R
\name{label_tex}
\alias{label_tex}
\title{A labeller function to parse TeX syntax}
\usage{
label_tex(labels, ...)
}
\arguments{
\item{labels}{Data frame of labels. Usually contains only one
element, but faceting over multiple factors entails multiple
label variables.}
\item{...}{
Arguments passed on to \code{\link[ggplot2:labellers]{ggplot2::label_parsed}}
\describe{
\item{\code{multi_line}}{Whether to display the labels of multiple factors
on separate lines.}
}}
}
\description{
This function formats the strip labels of facet grids and wraps that contains
TeX expressions. The latex2exp package must be installed.
}
\examples{
# requires latex2exp package be installed
if (requireNamespace("latex2exp", quietly = TRUE)) {
library(ggplot2)
d <- data.frame(x = 1, y = 1, facet = "$\\\\beta$")
ggplot(d, aes(x, y)) +
geom_point() +
facet_wrap(~ facet, labeller = label_tex)
}
}
\seealso{
\link[ggplot2:labeller]{ggplot2::labeller}, \code{\link[latex2exp:TeX]{latex2exp::TeX()}}
}
ggforce/man/geom_mark_hull.Rd 0000644 0001762 0000144 00000023777 14564603246 015747 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mark_hull.R
\name{geom_mark_hull}
\alias{geom_mark_hull}
\title{Annotate areas with hulls}
\usage{
geom_mark_hull(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
expand = unit(5, "mm"),
radius = unit(2.5, "mm"),
concavity = 2,
label.margin = margin(2, 2, 2, 2, "mm"),
label.width = NULL,
label.minwidth = unit(50, "mm"),
label.hjust = 0,
label.fontsize = 12,
label.family = "",
label.lineheight = 1,
label.fontface = c("bold", "plain"),
label.fill = "white",
label.colour = "black",
label.buffer = unit(10, "mm"),
con.colour = "black",
con.size = 0.5,
con.type = "elbow",
con.linetype = 1,
con.border = "one",
con.cap = unit(3, "mm"),
con.arrow = NULL,
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{expand}{A numeric or unit vector of length one, specifying the
expansion amount. Negative values will result in contraction instead. If the
value is given as a numeric it will be understood as a proportion of the
plot area width.}
\item{radius}{As \code{expand} but specifying the corner radius.}
\item{concavity}{A measure of the concavity of the hull. \code{1} is very concave
while it approaches convex as it grows. Defaults to \code{2}.}
\item{label.margin}{The margin around the annotation boxes, given by a call
to \code{\link[ggplot2:element]{ggplot2::margin()}}.}
\item{label.width}{A fixed width for the label. Set to \code{NULL} to let the text
or \code{label.minwidth} decide.}
\item{label.minwidth}{The minimum width to provide for the description. If
the size of the label exceeds this, the description is allowed to fill as
much as the label.}
\item{label.hjust}{The horizontal justification for the annotation. If it
contains two elements the first will be used for the label and the second for
the description.}
\item{label.fontsize}{The size of the text for the annotation. If it contains
two elements the first will be used for the label and the second for the
description.}
\item{label.family}{The font family used for the annotation. If it contains
two elements the first will be used for the label and the second for the
description.}
\item{label.lineheight}{The height of a line as a multipler of the fontsize.
If it contains two elements the first will be used for the label and the
second for the description.}
\item{label.fontface}{The font face used for the annotation. If it contains
two elements the first will be used for the label and the second for the
description.}
\item{label.fill}{The fill colour for the annotation box.}
\item{label.colour}{The text colour for the annotation. If it contains
two elements the first will be used for the label and the second for the
description.}
\item{label.buffer}{The size of the region around the mark where labels
cannot be placed.}
\item{con.colour}{The colour for the line connecting the annotation to the
mark.}
\item{con.size}{The width of the connector.}
\item{con.type}{The type of the connector. Either \code{"elbow"}, \code{"straight"}, or
\code{"none"}.}
\item{con.linetype}{The linetype of the connector.}
\item{con.border}{The bordertype of the connector. Either \code{"one"} (to draw a
line on the horizontal side closest to the mark), \code{"all"} (to draw a border
on all sides), or \code{"none"} (not going to explain that one).}
\item{con.cap}{The distance before the mark that the line should stop at.}
\item{con.arrow}{An arrow specification for the connection using
\code{\link[grid:arrow]{grid::arrow()}} for the end pointing towards the mark.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
}
\description{
This geom lets you annotate sets of points via hulls. While convex hulls are
most common due to their clear definition, they can lead to large areas
covered that does not contain points. Due to this \code{geom_mark_hull} uses
concaveman which lets you adjust concavity of the resulting hull. The hull is
calculated at draw time, and can thus change as you resize the plot. In order
to clearly contain all points, and for aesthetic purpose the resulting hull
is expanded 5mm and rounded on the corners. This can be adjusted with the
\code{expand} and \code{radius} parameters.
}
\section{Aesthetics}{
\code{geom_mark_hull} understand the following aesthetics (required aesthetics are
in bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item x0 \emph{(used to anchor the label)}
\item y0 \emph{(used to anchor the label)}
\item filter
\item label
\item description
\item color
\item fill
\item group
\item size
\item linetype
\item alpha
}
}
\section{Annotation}{
All \verb{geom_mark_*} allow you to put descriptive textboxes connected to the
mark on the plot, using the \code{label} and \code{description} aesthetics. The
textboxes are automatically placed close to the mark, but without obscuring
any of the datapoints in the layer. The placement is dynamic so if you resize
the plot you'll see that the annotation might move around as areas become big
enough or too small to fit the annotation. If there's not enough space for
the annotation without overlapping data it will not get drawn. In these cases
try resizing the plot, change the size of the annotation, or decrease the
buffer region around the marks.
}
\section{Filtering}{
Often marks are used to draw attention to, or annotate specific features of
the plot and it is thus not desirable to have marks around everything. While
it is possible to simply pre-filter the data used for the mark layer, the
\verb{geom_mark_*} geoms also comes with a dedicated \code{filter} aesthetic that, if
set, will remove all rows where it evalutates to \code{FALSE}. There are
multiple benefits of using this instead of prefiltering. First, you don't
have to change your data source, making your code more adaptable for
exploration. Second, the data removed by the filter aesthetic is remembered
by the geom, and any annotation will take care not to overlap with the
removed data.
}
\examples{
## requires the concaveman packages
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_hull(aes(fill = Species, filter = Species != 'versicolor')) +
geom_point()
# Adjusting the concavity lets you change the shape of the hull
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_hull(aes(fill = Species, filter = Species != 'versicolor'),
concavity = 1
) +
geom_point()
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_hull(aes(fill = Species, filter = Species != 'versicolor'),
concavity = 10
) +
geom_point()
# Add annotation
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_hull(aes(fill = Species, label = Species)) +
geom_point()
# Long descriptions are automatically wrapped to fit into the width
iris$desc <- c(
'A super Iris - and it knows it',
'Pretty mediocre Iris, but give it a couple of years and it might surprise you',
"You'll never guess what this Iris does every Sunday"
)[iris$Species]
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_hull(aes(fill = Species, label = Species, description = desc,
filter = Species == 'setosa')) +
geom_point()
# Change the buffer size to move labels farther away (or closer) from the
# marks
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_hull(aes(fill = Species, label = Species),
label.buffer = unit(40, 'mm')) +
geom_point()
# The connector is capped a bit before it reaches the mark, but this can be
# controlled
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_hull(aes(fill = Species, label = Species),
con.cap = 0) +
geom_point()
}
\seealso{
Other mark geoms:
\code{\link{geom_mark_circle}()},
\code{\link{geom_mark_ellipse}()},
\code{\link{geom_mark_rect}()}
}
\concept{mark geoms}
ggforce/man/geom_bspline.Rd 0000644 0001762 0000144 00000015637 14303120026 015376 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bspline.R
\name{geom_bspline}
\alias{geom_bspline}
\alias{stat_bspline}
\alias{stat_bspline2}
\alias{geom_bspline2}
\alias{stat_bspline0}
\alias{geom_bspline0}
\title{B-splines based on control points}
\usage{
stat_bspline(
mapping = NULL,
data = NULL,
geom = "path",
position = "identity",
na.rm = FALSE,
n = 100,
type = "clamped",
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_bspline(
mapping = NULL,
data = NULL,
stat = "bspline",
position = "identity",
arrow = NULL,
n = 100,
type = "clamped",
lineend = "butt",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_bspline2(
mapping = NULL,
data = NULL,
geom = "path_interpolate",
position = "identity",
na.rm = FALSE,
n = 100,
type = "clamped",
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_bspline2(
mapping = NULL,
data = NULL,
stat = "bspline2",
position = "identity",
arrow = NULL,
n = 100,
type = "clamped",
lineend = "butt",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_bspline0(
mapping = NULL,
data = NULL,
geom = "bspline0",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
type = "clamped",
...
)
geom_bspline0(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
arrow = NULL,
lineend = "butt",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
type = "clamped",
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{n}{The number of points generated for each spline}
\item{type}{Either \code{'clamped'} (default) or \code{'open'}. The former creates a
knot sequence that ensures the splines starts and ends at the terminal
control points.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{arrow}{Arrow specification, as created by \code{\link[grid:arrow]{grid::arrow()}}.}
\item{lineend}{Line end style (round, butt, square).}
}
\description{
This set of stats and geoms makes it possible to draw b-splines based on a
set of control points. As with \code{\link[=geom_bezier]{geom_bezier()}} there exists several
versions each having there own strengths. The base version calculates the
b-spline as a number of points along the spline and connects these with a
path. The *2 version does the same but in addition interpolates aesthetics
between each control point. This makes the *2 version considerably slower
so it shouldn't be used unless needed. The *0 version uses
\code{\link[grid:grid.xspline]{grid::xsplineGrob()}} with \code{shape = 1} to approximate a b-spline.
}
\section{Aesthetics}{
geom_bspline understand the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item color
\item linewidth
\item linetype
\item alpha
\item lineend
}
}
\section{Computed variables}{
\describe{
\item{x, y}{The coordinates for the path describing the spline}
\item{index}{The progression along the interpolation mapped between 0 and 1}
}
}
\examples{
# Define some control points
cp <- data.frame(
x = c(
0, -5, -5, 5, 5, 2.5, 5, 7.5, 5, 2.5, 5, 7.5, 5, -2.5, -5, -7.5, -5,
-2.5, -5, -7.5, -5
),
y = c(
0, -5, 5, -5, 5, 5, 7.5, 5, 2.5, -5, -7.5, -5, -2.5, 5, 7.5, 5, 2.5,
-5, -7.5, -5, -2.5
),
class = sample(letters[1:3], 21, replace = TRUE)
)
# Now create some paths between them
paths <- data.frame(
ind = c(
7, 5, 8, 8, 5, 9, 9, 5, 6, 6, 5, 7, 7, 5, 1, 3, 15, 8, 5, 1, 3, 17, 9, 5,
1, 2, 19, 6, 5, 1, 4, 12, 7, 5, 1, 4, 10, 6, 5, 1, 2, 20
),
group = c(
1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7,
7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10
)
)
paths$x <- cp$x[paths$ind]
paths$y <- cp$y[paths$ind]
paths$class <- cp$class[paths$ind]
ggplot(paths) +
geom_bspline(aes(x = x, y = y, group = group, colour = after_stat(index))) +
geom_point(aes(x = x, y = y), data = cp, color = 'steelblue')
ggplot(paths) +
geom_bspline2(aes(x = x, y = y, group = group, colour = class)) +
geom_point(aes(x = x, y = y), data = cp, color = 'steelblue')
ggplot(paths) +
geom_bspline0(aes(x = x, y = y, group = group)) +
geom_point(aes(x = x, y = y), data = cp, color = 'steelblue')
}
\author{
Thomas Lin Pedersen. The C++ code for De Boor's algorithm has been
adapted from
\href{https://chi3x10.wordpress.com/2009/10/18/de-boor-algorithm-in-c/}{Jason Yu-Tseh Chi implementation}
}
ggforce/man/gather_set_data.Rd 0000644 0001762 0000144 00000001304 14564603246 016056 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/parallel_sets.R
\name{gather_set_data}
\alias{gather_set_data}
\title{Tidy data for use with geom_parallel_sets}
\usage{
gather_set_data(data, x, id_name = "id")
}
\arguments{
\item{data}{A tidy dataframe with some categorical columns}
\item{x}{The columns to use for axes in the parallel sets diagram}
\item{id_name}{The name of the column that will contain the original index of
the row.}
}
\value{
A data.frame
}
\description{
This helper function makes it easy to change tidy data into a tidy(er) format
that can be used by geom_parallel_sets.
}
\examples{
data <- reshape2::melt(Titanic)
head(gather_set_data(data, 1:4))
}
ggforce/man/facet_grid_paginate.Rd 0000644 0001762 0000144 00000010432 14564603706 016702 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/facet_grid_paginate.R
\name{facet_grid_paginate}
\alias{facet_grid_paginate}
\title{Split facet_grid over multiple plots}
\usage{
facet_grid_paginate(
facets,
margins = FALSE,
scales = "fixed",
space = "fixed",
shrink = TRUE,
labeller = "label_value",
as.table = TRUE,
switch = NULL,
drop = TRUE,
ncol = NULL,
nrow = NULL,
page = 1,
byrow = TRUE
)
}
\arguments{
\item{facets}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Please use \code{rows}
and \code{cols} instead.}
\item{margins}{Either a logical value or a character
vector. Margins are additional facets which contain all the data
for each of the possible values of the faceting variables. If
\code{FALSE}, no additional facets are included (the
default). If \code{TRUE}, margins are included for all faceting
variables. If specified as a character vector, it is the names of
variables for which margins are to be created.}
\item{scales}{Are scales shared across all facets (the default,
\code{"fixed"}), or do they vary across rows (\code{"free_x"}),
columns (\code{"free_y"}), or both rows and columns (\code{"free"})?}
\item{space}{If \code{"fixed"}, the default, all panels have the same size.
If \code{"free_y"} their height will be proportional to the length of the
y scale; if \code{"free_x"} their width will be proportional to the
length of the x scale; or if \code{"free"} both height and width will
vary. This setting has no effect unless the appropriate scales also vary.}
\item{shrink}{If \code{TRUE}, will shrink scales to fit output of
statistics, not raw data. If \code{FALSE}, will be range of raw data
before statistical summary.}
\item{labeller}{A function that takes one data frame of labels and
returns a list or data frame of character vectors. Each input
column corresponds to one factor. Thus there will be more than
one with \code{vars(cyl, am)}. Each output
column gets displayed as one separate line in the strip
label. This function should inherit from the "labeller" S3 class
for compatibility with \code{\link[ggplot2:labeller]{labeller()}}. You can use different labeling
functions for different kind of labels, for example use \code{\link[ggplot2:label_parsed]{label_parsed()}} for
formatting facet labels. \code{\link[ggplot2:label_value]{label_value()}} is used by default,
check it for more details and pointers to other options.}
\item{as.table}{If \code{TRUE}, the default, the facets are laid out like
a table with highest values at the bottom-right. If \code{FALSE}, the
facets are laid out like a plot with the highest value at the top-right.}
\item{switch}{By default, the labels are displayed on the top and
right of the plot. If \code{"x"}, the top labels will be
displayed to the bottom. If \code{"y"}, the right-hand side
labels will be displayed to the left. Can also be set to
\code{"both"}.}
\item{drop}{If \code{TRUE}, the default, all factor levels not used in the
data will automatically be dropped. If \code{FALSE}, all factor levels
will be shown, regardless of whether or not they appear in the data.}
\item{ncol}{Number of columns per page}
\item{nrow}{Number of rows per page}
\item{page}{The page to draw}
\item{byrow}{Should the pages be created row-wise or column wise}
}
\description{
This extension to \code{\link[ggplot2:facet_grid]{ggplot2::facet_grid()}} will allow you to split
a facetted plot over multiple pages. You define a number of rows and columns
per page as well as the page number to plot, and the function will
automatically only plot the correct panels. Usually this will be put in a
loop to render all pages one by one.
}
\note{
If either \code{ncol} or \code{nrow} is \code{NULL} this function will
fall back to the standard \code{facet_grid} functionality.
}
\examples{
# Draw a small section of the grid
ggplot(diamonds) +
geom_point(aes(carat, price), alpha = 0.1) +
facet_grid_paginate(color ~ cut:clarity, ncol = 3, nrow = 3, page = 4)
}
\seealso{
\code{\link[=n_pages]{n_pages()}} to compute the total number of pages in a paginated
faceted plot
Other ggforce facets:
\code{\link{facet_stereo}()},
\code{\link{facet_wrap_paginate}()},
\code{\link{facet_zoom}()}
}
\concept{ggforce facets}
ggforce/man/geom_arc.Rd 0000644 0001762 0000144 00000015025 14553466074 014525 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/arc.R
\name{geom_arc}
\alias{geom_arc}
\alias{stat_arc}
\alias{stat_arc2}
\alias{geom_arc2}
\alias{stat_arc0}
\alias{geom_arc0}
\title{Arcs based on radius and radians}
\usage{
stat_arc(
mapping = NULL,
data = NULL,
geom = "arc",
position = "identity",
na.rm = FALSE,
show.legend = NA,
n = 360,
inherit.aes = TRUE,
...
)
geom_arc(
mapping = NULL,
data = NULL,
stat = "arc",
position = "identity",
n = 360,
arrow = NULL,
lineend = "butt",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_arc2(
mapping = NULL,
data = NULL,
geom = "path_interpolate",
position = "identity",
na.rm = FALSE,
show.legend = NA,
n = 360,
inherit.aes = TRUE,
...
)
geom_arc2(
mapping = NULL,
data = NULL,
stat = "arc2",
position = "identity",
n = 360,
arrow = NULL,
lineend = "butt",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_arc0(
mapping = NULL,
data = NULL,
geom = "arc0",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_arc0(
mapping = NULL,
data = NULL,
stat = "arc0",
position = "identity",
ncp = 5,
arrow = NULL,
lineend = "butt",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{n}{the smoothness of the arc. Sets the number of points to use if the
arc would cover a full circle}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{arrow}{Arrow specification, as created by \code{\link[grid:arrow]{grid::arrow()}}.}
\item{lineend}{Line end style (round, butt, square).}
\item{ncp}{the number of control points used to draw the arc with curveGrob.
Determines how well the arc approximates a circle section}
}
\description{
This set of stats and geoms makes it possible to draw circle segments based
on a center point, a radius and a start and end angle (in radians). These
functions are intended for cartesian coordinate systems and makes it possible
to create circular plot types without using the
\code{\link[ggplot2:coord_polar]{ggplot2::coord_polar()}} coordinate system.
}
\details{
An arc is a segment of a line describing a circle. It is the
fundamental visual element in donut charts where the length of the segment
(and conversely the angular span of the segment) describes the proportion of
an entety.
}
\section{Aesthetics}{
geom_arc understand the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x0}
\item \strong{y0}
\item \strong{r}
\item \strong{start}
\item \strong{end}
\item color
\item linewidth
\item linetype
\item alpha
\item lineend
}
}
\section{Computed variables}{
\describe{
\item{x, y}{The start coordinates for the segment}
\item{xend, yend}{The end coordinates for the segment}
\item{curvature}{The curvature of the curveGrob to match a circle}
}
}
\examples{
# Lets make some data
arcs <- data.frame(
start = seq(0, 2 * pi, length.out = 11)[-11],
end = seq(0, 2 * pi, length.out = 11)[-1],
r = rep(1:2, 5)
)
# Behold the arcs
ggplot(arcs) +
geom_arc(aes(x0 = 0, y0 = 0, r = r, start = start, end = end,
linetype = factor(r)))
# Use the calculated index to map values to position on the arc
ggplot(arcs) +
geom_arc(aes(x0 = 0, y0 = 0, r = r, start = start, end = end,
size = after_stat(index)), lineend = 'round')
# The 0 version maps directly to curveGrob instead of calculating the points
# itself
ggplot(arcs) +
geom_arc0(aes(x0 = 0, y0 = 0, r = r, start = start, end = end,
linetype = factor(r)))
# The 2 version allows interpolation of aesthetics between the start and end
# points
arcs2 <- data.frame(
angle = c(arcs$start, arcs$end),
r = rep(arcs$r, 2),
group = rep(1:10, 2),
colour = sample(letters[1:5], 20, TRUE)
)
ggplot(arcs2) +
geom_arc2(aes(x0 = 0, y0 = 0, r = r, end = angle, group = group,
colour = colour), size = 2)
}
\seealso{
\code{\link[=geom_arc_bar]{geom_arc_bar()}} for drawing arcs with fill
}
ggforce/man/geom_spiro.Rd 0000644 0001762 0000144 00000011406 14303120026 015064 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spiro.R
\name{geom_spiro}
\alias{geom_spiro}
\alias{stat_spiro}
\title{Draw spirograms based on the radii of the different "wheels" involved}
\usage{
stat_spiro(
mapping = NULL,
data = NULL,
geom = "path",
position = "identity",
na.rm = FALSE,
n = 500,
revolutions = NULL,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_spiro(
mapping = NULL,
data = NULL,
stat = "spiro",
position = "identity",
arrow = NULL,
n = 500,
lineend = "butt",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{n}{The number of points that should be used to draw a fully closed
spirogram. If \code{revolutions < 1} the actual number of points will be less
than this.}
\item{revolutions}{The number of times the inner gear should revolve around
inside the outer gear. If \code{NULL} the number of revolutions to reach the
starting position is calculated and used.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{arrow}{Arrow specification, as created by \code{\link[grid:arrow]{grid::arrow()}}.}
\item{lineend}{Line end style (round, butt, square).}
}
\description{
This, rather pointless, geom allows you to draw spirograms, as known from the
popular drawing toy where lines were traced by inserting a pencil into a hole
in a small gear that would then trace around inside another gear. The
potential practicality of this geom is slim and it excists mainly for fun and
art.
}
\section{Aesthetics}{
stat_spiro and geom_spiro understand the following aesthetics (required
aesthetics are in bold):
\itemize{
\item \strong{R}
\item \strong{r}
\item \strong{d}
\item x0
\item y0
\item outer
\item color
\item size
\item linetype
\item alpha
}
}
\section{Computed variables}{
\describe{
\item{x, y}{The coordinates for the path describing the spirogram}
\item{index}{The progression along the spirogram mapped between 0 and 1}
}
}
\examples{
# Basic usage
ggplot() +
geom_spiro(aes(R = 10, r = 3, d = 5))
# Only draw a portion
ggplot() +
geom_spiro(aes(R = 10, r = 3, d = 5), revolutions = 1.2)
# Let the inner gear circle the outside of the outer gear
ggplot() +
geom_spiro(aes(R = 10, r = 3, d = 5, outer = TRUE))
}
ggforce/man/geom_shape.Rd 0000644 0001762 0000144 00000011236 14303120026 015031 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shape.R
\name{geom_shape}
\alias{geom_shape}
\title{Draw polygons with expansion/contraction and/or rounded corners}
\usage{
geom_shape(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
expand = 0,
radius = 0,
...,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{expand}{A numeric or unit vector of length one, specifying the
expansion amount. Negative values will result in contraction instead. If the
value is given as a numeric it will be understood as a proportion of the
plot area width.}
\item{radius}{As \code{expand} but specifying the corner radius.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
}
\description{
This geom is a cousin of \code{\link[ggplot2:geom_polygon]{ggplot2::geom_polygon()}} with the added
possibility of expanding or contracting the polygon by an absolute amount
(e.g. 1 cm). Furthermore, it is possible to round the corners of the polygon,
again by an absolute amount. The resulting geom reacts to resizing of the
plot, so the expansion/contraction and corner radius will not get distorted.
If no expansion/contraction or corner radius is specified, the geom falls
back to \code{geom_polygon} so there is no performance penality in using this
instead of \code{geom_polygon}.
}
\note{
Some settings can result in the dissappearance of polygons,
specifically when contracting or rounding corners with a relatively large
amount. Also note that x and y scale limits does not take expansion into
account and the resulting polygon might thus not fit into the plot.
}
\section{Aesthetics}{
geom_shape understand the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item color
\item fill
\item group
\item size
\item linetype
\item alpha
}
}
\examples{
shape <- data.frame(
x = c(0.5, 1, 0.75, 0.25, 0),
y = c(0, 0.5, 1, 0.75, 0.25)
)
# Expand and round
ggplot(shape, aes(x = x, y = y)) +
geom_shape(expand = unit(1, 'cm'), radius = unit(0.5, 'cm')) +
geom_polygon(fill = 'red')
# Contract
ggplot(shape, aes(x = x, y = y)) +
geom_polygon(fill = 'red') +
geom_shape(expand = unit(-1, 'cm'))
# Only round corners
ggplot(shape, aes(x = x, y = y)) +
geom_polygon(fill = 'red') +
geom_shape(radius = unit(1, 'cm'))
}
\author{
Thomas Lin Pedersen
}
ggforce/man/ggforce-package.Rd 0000644 0001762 0000144 00000005050 14303103037 015727 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ggforce-package.R
\docType{package}
\name{ggforce-package}
\alias{ggforce}
\alias{ggforce-package}
\title{ggforce: Accelerating 'ggplot2'}
\description{
\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}}
The aim of 'ggplot2' is to aid in visual data investigations. This focus has led to a lack of facilities for composing specialised plots. 'ggforce' aims to be a collection of mainly new stats and geoms that fills this gap. All additional functionality is aimed to come through the official extension system so using 'ggforce' should be a stable experience.
}
\examples{
rocketData <- data.frame(
x = c(1, 1, 2, 2),
y = c(1, 2, 2, 3)
)
rocketData <- do.call(rbind, lapply(seq_len(500) - 1, function(i) {
rocketData$y <- rocketData$y - c(0, i / 500)
rocketData$group <- i + 1
rocketData
}))
rocketData2 <- data.frame(
x = c(2, 2.25, 2),
y = c(2, 2.5, 3)
)
rocketData2 <- do.call(rbind, lapply(seq_len(500) - 1, function(i) {
rocketData2$x[2] <- rocketData2$x[2] - i * 0.25 / 500
rocketData2$group <- i + 1 + 500
rocketData2
}))
ggplot() + geom_link(aes(
x = 2, y = 2, xend = 3, yend = 3, alpha = after_stat(index),
size = after_stat(index)
), colour = 'goldenrod', n = 500) +
geom_bezier(aes(x = x, y = y, group = group, colour = after_stat(index)),
data = rocketData
) +
geom_bezier(aes(x = y, y = x, group = group, colour = after_stat(index)),
data = rocketData
) +
geom_bezier(aes(x = x, y = y, group = group, colour = 1),
data = rocketData2
) +
geom_bezier(aes(x = y, y = x, group = group, colour = 1),
data = rocketData2
) +
geom_text(aes(x = 1.65, y = 1.65, label = 'ggplot2', angle = 45),
colour = 'white', size = 15
) +
coord_fixed() +
scale_x_reverse() +
scale_y_reverse() +
scale_alpha(range = c(1, 0), guide = 'none') +
scale_size_continuous(
range = c(20, 0.1), trans = 'exp',
guide = 'none'
) +
scale_color_continuous(guide = 'none') +
xlab('') + ylab('') +
ggtitle('ggforce: Accelerating ggplot2') +
theme(plot.title = element_text(size = 20))
}
\seealso{
Useful links:
\itemize{
\item \url{https://ggforce.data-imaginist.com}
\item \url{https://github.com/thomasp85/ggforce}
\item Report bugs at \url{https://github.com/thomasp85/ggforce/issues}
}
}
\author{
\strong{Maintainer}: Thomas Lin Pedersen \email{thomasp85@gmail.com} (\href{https://orcid.org/0000-0002-5147-4711}{ORCID})
Other contributors:
\itemize{
\item RStudio [copyright holder]
}
}
\keyword{internal}
ggforce/man/ggforce-extensions.Rd 0000644 0001762 0000144 00000004366 14277137746 016574 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shape.R, R/arc_bar.R, R/arc.R, R/autodensity.R,
% R/autohistogram.R, R/bezier.R, R/bspline.R, R/bspline_closed.R,
% R/circle.R, R/diagonal.R, R/diagonal_wide.R, R/ellipse.R, R/errorbar.R,
% R/facet_grid_paginate.R, R/facet_matrix.R, R/facet_row.R, R/facet_stereo.R,
% R/facet_wrap_paginate.R, R/facet_zoom.R, R/ggproto-classes.R,
% R/interpolate.R, R/link.R, R/mark_circle.R, R/mark_ellipse.R,
% R/mark_hull.R, R/mark_rect.R, R/parallel_sets.R, R/position-jitternormal.R,
% R/position_auto.R, R/position_floatstack.R, R/regon.R, R/sina.R, R/spiro.R,
% R/voronoi.R
\docType{data}
\name{GeomShape}
\alias{GeomShape}
\alias{StatArcBar}
\alias{StatPie}
\alias{GeomArcBar}
\alias{StatArc}
\alias{GeomArc}
\alias{StatArc2}
\alias{StatArc0}
\alias{GeomArc0}
\alias{StatAutodensity}
\alias{GeomAutoarea}
\alias{StatAutobin}
\alias{GeomAutorect}
\alias{StatBezier}
\alias{StatBezier2}
\alias{StatBezier0}
\alias{GeomBezier0}
\alias{StatBspline}
\alias{StatBspline2}
\alias{GeomBspline0}
\alias{GeomBsplineClosed0}
\alias{StatCircle}
\alias{GeomCircle}
\alias{StatDiagonal}
\alias{StatDiagonal2}
\alias{StatDiagonal0}
\alias{StatDiagonalWide}
\alias{StatEllip}
\alias{StatErr}
\alias{FacetGridPaginate}
\alias{FacetMatrix}
\alias{FacetRow}
\alias{FacetCol}
\alias{FacetStereo}
\alias{FacetWrapPaginate}
\alias{FacetZoom}
\alias{ggforce-extensions}
\alias{GeomPathInterpolate}
\alias{StatLink}
\alias{StatLink2}
\alias{GeomMarkCircle}
\alias{GeomMarkEllipse}
\alias{GeomMarkHull}
\alias{GeomMarkRect}
\alias{StatParallelSets}
\alias{StatParallelSetsAxes}
\alias{GeomParallelSetsAxes}
\alias{PositionJitterNormal}
\alias{PositionAuto}
\alias{PositionFloatstack}
\alias{StatRegon}
\alias{StatSina}
\alias{StatSpiro}
\alias{StatVoronoiTile}
\alias{StatVoronoiSegment}
\alias{StatDelaunayTile}
\alias{StatDelaunaySegment}
\alias{StatDelaunaySegment2}
\alias{StatDelvorSummary}
\title{ggforce extensions to ggplot2}
\description{
ggforce makes heavy use of the ggproto class system to extend the
functionality of ggplot2. In general the actual classes should be of little
interest to users as the standard ggplot2 api of using geom_* and stat_*
functions for building up the plot is encouraged.
}
\keyword{datasets}
ggforce/man/geom_arc_bar.Rd 0000644 0001762 0000144 00000014675 14303413453 015345 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/arc_bar.R
\name{geom_arc_bar}
\alias{geom_arc_bar}
\alias{stat_arc_bar}
\alias{stat_pie}
\title{Arcs and wedges as polygons}
\usage{
stat_arc_bar(
mapping = NULL,
data = NULL,
geom = "arc_bar",
position = "identity",
n = 360,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_pie(
mapping = NULL,
data = NULL,
geom = "arc_bar",
position = "identity",
n = 360,
sep = 0,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_arc_bar(
mapping = NULL,
data = NULL,
stat = "arc_bar",
position = "identity",
n = 360,
expand = 0,
radius = 0,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{n}{The number of points used to draw a full circle. The number of
points on each arc will then be calculated as n / span-of-arc}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{sep}{The separation between arcs in pie/donut charts}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{expand}{A numeric or unit vector of length one, specifying the
expansion amount. Negative values will result in contraction instead. If the
value is given as a numeric it will be understood as a proportion of the
plot area width.}
\item{radius}{As \code{expand} but specifying the corner radius.}
}
\description{
This set of stats and geoms makes it possible to draw arcs and wedges as
known from pie and donut charts as well as more specialized plottypes such as
sunburst plots.
}
\details{
An arc bar is the thick version of an arc; that is, a circle segment
drawn as a polygon in the same way as a rectangle is a thick version of a
line. A wedge is a special case of an arc where the inner radius is 0. As
opposed to applying coord_polar to a stacked bar chart, these layers are
drawn in cartesian space, which allows for transformations not possible with
the native ggplot2 approach. Most notable of these are the option to explode
arcs and wedgets away from their center point, thus detaching it from the
main pie/donut.
}
\section{Aesthetics}{
geom_arc_bar understand the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x0}
\item \strong{y0}
\item \strong{r0}
\item \strong{r}
\item \strong{start} - when using stat_arc_bar
\item \strong{end} - when using stat_arc_bar
\item \strong{amount} - when using stat_pie
\item explode
\item color
\item fill
\item linewidth
\item linetype
\item alpha
}
}
\section{Computed variables}{
\describe{
\item{x, y}{x and y coordinates for the polygon}
}
\describe{
\item{x, y}{The start coordinates for the segment}
}
}
\examples{
# If you know the angle spans to plot it is easy
arcs <- data.frame(
start = seq(0, 2 * pi, length.out = 11)[-11],
end = seq(0, 2 * pi, length.out = 11)[-1],
r = rep(1:2, 5)
)
# Behold the arcs
ggplot(arcs) +
geom_arc_bar(aes(x0 = 0, y0 = 0, r0 = r - 1, r = r, start = start,
end = end, fill = r))
# geom_arc_bar uses geom_shape to draw the arcs, so you have all the
# possibilities of that as well, e.g. rounding of corners
ggplot(arcs) +
geom_arc_bar(aes(x0 = 0, y0 = 0, r0 = r - 1, r = r, start = start,
end = end, fill = r), radius = unit(4, 'mm'))
# If you got values for a pie chart, use stat_pie
states <- c(
'eaten', "eaten but said you didn\'t", 'cat took it', 'for tonight',
'will decompose slowly'
)
pie <- data.frame(
state = factor(rep(states, 2), levels = states),
type = rep(c('Pie', 'Donut'), each = 5),
r0 = rep(c(0, 0.8), each = 5),
focus = rep(c(0.2, 0, 0, 0, 0), 2),
amount = c(4, 3, 1, 1.5, 6, 6, 1, 2, 3, 2)
)
# Look at the cakes
ggplot() + geom_arc_bar(aes(
x0 = 0, y0 = 0, r0 = r0, r = 1, amount = amount,
fill = state, explode = focus
),
data = pie, stat = 'pie'
) +
facet_wrap(~type, ncol = 1) +
coord_fixed() +
theme_no_axes() +
scale_fill_brewer('', type = 'qual')
}
\seealso{
\code{\link[=geom_arc]{geom_arc()}} for drawing arcs as lines
}
ggforce/man/theme_no_axes.Rd 0000644 0001762 0000144 00000001324 13674074434 015562 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/themes.R
\name{theme_no_axes}
\alias{theme_no_axes}
\title{Theme without axes and gridlines}
\usage{
theme_no_axes(base.theme = theme_bw())
}
\arguments{
\item{base.theme}{The theme to use as a base for the new theme. Defaults to
\code{\link[ggplot2:ggtheme]{ggplot2::theme_bw()}}.}
}
\value{
A modified version of base.theme
}
\description{
This theme is a simple wrapper around any complete theme that removes the
axis text, title and ticks as well as the grid lines for plots where these
have little meaning.
}
\examples{
p <- ggplot() + geom_point(aes(x = wt, y = qsec), data = mtcars)
p + theme_no_axes()
p + theme_no_axes(theme_grey())
}
ggforce/man/geom_ellipse.Rd 0000644 0001762 0000144 00000010752 14303120026 015370 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ellipse.R
\name{geom_ellipse}
\alias{geom_ellipse}
\alias{stat_ellip}
\title{Draw (super)ellipses based on the coordinate system scale}
\usage{
stat_ellip(
mapping = NULL,
data = NULL,
geom = "circle",
position = "identity",
n = 360,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_ellipse(
mapping = NULL,
data = NULL,
stat = "ellip",
position = "identity",
n = 360,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{n}{The number of points to sample along the ellipse.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
}
\description{
This is a generalisation of \code{\link[=geom_circle]{geom_circle()}} that allows you to draw
ellipses at a specified angle and center relative to the coordinate system.
Apart from letting you draw regular ellipsis, the stat is using the
generalised formula for superellipses which can be utilised by setting the
\code{m1} and \code{m2} aesthetics. If you only set the m1 the m2 value will follow
that to ensure a symmetric appearance.
}
\section{Aesthetics}{
geom_arc understand the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x0}
\item \strong{y0}
\item \strong{a}
\item \strong{b}
\item \strong{angle}
\item m1
\item m2
\item color
\item fill
\item linewidth
\item linetype
\item alpha
\item lineend
}
}
\section{Computed variables}{
\describe{
\item{x, y}{The coordinates for the points along the ellipse}
}
}
\examples{
# Basic usage
ggplot() +
geom_ellipse(aes(x0 = 0, y0 = 0, a = 10, b = 3, angle = 0)) +
coord_fixed()
# Rotation
# Note that it expects radians and rotates the ellipse counter-clockwise
ggplot() +
geom_ellipse(aes(x0 = 0, y0 = 0, a = 10, b = 3, angle = pi / 4)) +
coord_fixed()
# Draw a super ellipse
ggplot() +
geom_ellipse(aes(x0 = 0, y0 = 0, a = 6, b = 3, angle = -pi / 3, m1 = 3)) +
coord_fixed()
}
ggforce/man/geom_parallel_sets.Rd 0000644 0001762 0000144 00000017013 14303413453 016573 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/parallel_sets.R
\name{geom_parallel_sets}
\alias{geom_parallel_sets}
\alias{stat_parallel_sets}
\alias{stat_parallel_sets_axes}
\alias{geom_parallel_sets_axes}
\alias{geom_parallel_sets_labels}
\title{Create Parallel Sets diagrams}
\usage{
stat_parallel_sets(
mapping = NULL,
data = NULL,
geom = "shape",
position = "identity",
n = 100,
strength = 0.5,
sep = 0.05,
axis.width = 0,
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_parallel_sets(
mapping = NULL,
data = NULL,
stat = "parallel_sets",
position = "identity",
n = 100,
na.rm = FALSE,
orientation = NA,
sep = 0.05,
strength = 0.5,
axis.width = 0,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_parallel_sets_axes(
mapping = NULL,
data = NULL,
geom = "parallel_sets_axes",
position = "identity",
sep = 0.05,
axis.width = 0,
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_parallel_sets_axes(
mapping = NULL,
data = NULL,
stat = "parallel_sets_axes",
position = "identity",
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_parallel_sets_labels(
mapping = NULL,
data = NULL,
stat = "parallel_sets_axes",
angle = -90,
nudge_x = 0,
nudge_y = 0,
position = "identity",
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{n}{The number of points to create for each of the bounding diagonals}
\item{strength}{The proportion to move the control point along the x-axis
towards the other end of the bezier curve}
\item{sep}{The proportional separation between categories within a variable}
\item{axis.width}{The width of the area around each variable axis}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{orientation}{The orientation of the layer. The default (\code{NA})
automatically determines the orientation from the aesthetic mapping. In the
rare event that this fails it can be given explicitly by setting \code{orientation}
to either \code{"x"} or \code{"y"}. See the \emph{Orientation} section for more detail.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{angle}{The angle of the axis label text}
\item{nudge_x, nudge_y}{Horizontal and vertical adjustment to nudge labels by.
Useful for offsetting text from the category segments.}
}
\description{
A parallel sets diagram is a type of visualisation showing the interaction
between multiple categorical variables. If the variables has an intrinsic
order the representation can be thought of as a Sankey Diagram. If each
variable is a point in time it will resemble an alluvial diagram.
}
\details{
In a parallel sets visualization each categorical variable will be assigned
a position on the x-axis. The size of the intersection of categories from
neighboring variables are then shown as thick diagonals, scaled by the sum of
elements shared between the two categories. The natural data representation
for such as plot is to have each categorical variable in a separate column
and then have a column giving the amount/magnitude of the combination of
levels in the row. This representation is unfortunately not fitting for the
\code{ggplot2} API which needs every position encoding in the same column. To make
it easier to work with \code{ggforce} provides a helper \code{\link[=gather_set_data]{gather_set_data()}}, which
takes care of the transformation.
}
\section{Aesthetics}{
geom_parallel_sets understand the following aesthetics
(required aesthetics are in bold):
\itemize{
\item \strong{x|y}
\item \strong{id}
\item \strong{split}
\item \strong{value}
\item color
\item fill
\item size
\item linetype
\item alpha
\item lineend
}
}
\section{Orientation}{
This geom treats each axis differently and, thus, can thus have two orientations. Often the orientation is easy to deduce from a combination of the given mappings and the types of positional scales in use. Thus, ggplot2 will by default try to guess which orientation the layer should have. Under rare circumstances, the orientation is ambiguous and guessing may fail. In that case the orientation can be specified directly using the \code{orientation} parameter, which can be either \code{"x"} or \code{"y"}. The value gives the axis that the geom should run along, \code{"x"} being the default orientation you would expect for the geom.
}
\examples{
data <- reshape2::melt(Titanic)
data <- gather_set_data(data, 1:4)
ggplot(data, aes(x, id = id, split = y, value = value)) +
geom_parallel_sets(aes(fill = Sex), alpha = 0.3, axis.width = 0.1) +
geom_parallel_sets_axes(axis.width = 0.1) +
geom_parallel_sets_labels(colour = 'white')
# Use nudge_x to offset and hjust = 0 to left-justify label
ggplot(data, aes(x, id = id, split = y, value = value)) +
geom_parallel_sets(aes(fill = Sex), alpha = 0.3, axis.width = 0.1) +
geom_parallel_sets_axes(axis.width = 0.1) +
geom_parallel_sets_labels(colour = 'red', angle = 0, nudge_x = 0.1, hjust = 0)
}
\author{
Thomas Lin Pedersen
}
ggforce/man/facet_zoom.Rd 0000644 0001762 0000144 00000006206 13674074434 015076 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/facet_zoom.R
\name{facet_zoom}
\alias{facet_zoom}
\title{Facet data for zoom with context}
\usage{
facet_zoom(
x,
y,
xy,
zoom.data,
xlim = NULL,
ylim = NULL,
split = FALSE,
horizontal = TRUE,
zoom.size = 2,
show.area = TRUE,
shrink = TRUE
)
}
\arguments{
\item{x, y, xy}{An expression evaluating to a logical vector that determines
the subset of data to zoom in on}
\item{zoom.data}{An expression evaluating to a logical vector. If \code{TRUE}
the data only shows in the zoom panels. If \code{FALSE} the data only show in
the context panel. If \code{NA} the data will show in all panels.}
\item{xlim, ylim}{Specific zoom ranges for each axis. If present they will
override \code{x}, \code{y}, and/or \code{xy}.}
\item{split}{If both \code{x} and \code{y} is given, should each axis zoom
be shown separately as well? Defaults to \code{FALSE}}
\item{horizontal}{If both \code{x} and \code{y} is given and
\code{split = FALSE} How should the zoom panel be positioned relative to the
full data panel? Defaults to \code{TRUE}}
\item{zoom.size}{Sets the relative size of the zoom panel to the full data
panel. The default (\code{2}) makes the zoom panel twice the size of the full
data panel.}
\item{show.area}{Should the zoom area be drawn below the data points on the
full data panel? Defaults to \code{TRUE}.}
\item{shrink}{If \code{TRUE}, will shrink scales to fit output of
statistics, not raw data. If \code{FALSE}, will be range of raw data
before statistical summary.}
}
\description{
This facetting provides the means to zoom in on a subset of the data, while
keeping the view of the full dataset as a separate panel. The zoomed-in area
will be indicated on the full dataset panel for reference. It is possible to
zoom in on both the x and y axis at the same time. If this is done it is
possible to both get each zoom separately and combined or just combined.
}
\examples{
# Zoom in on the versicolor species on the x-axis
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(x = Species == 'versicolor')
# Zoom in on versicolor on both axes
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(xy = Species == 'versicolor')
# Use different zoom criteria on each axis
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(x = Species != 'setosa', y = Species == 'versicolor')
# Get each axis zoom separately as well
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(xy = Species == 'versicolor', split = TRUE)
# Define the zoom area directly
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(xlim = c(2, 4))
# Selectively show data in the zoom panel
ggplot(iris, aes(Petal.Length, Petal.Width, colour = Species)) +
geom_point() +
facet_zoom(x = Species == 'versicolor', zoom.data = Species == 'versicolor')
}
\seealso{
Other ggforce facets:
\code{\link{facet_grid_paginate}()},
\code{\link{facet_stereo}()},
\code{\link{facet_wrap_paginate}()}
}
\concept{ggforce facets}
ggforce/man/facet_row.Rd 0000644 0001762 0000144 00000007407 14276646344 014731 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/facet_row.R
\name{facet_row}
\alias{facet_row}
\alias{facet_col}
\title{One-dimensional facets}
\usage{
facet_row(
facets,
scales = "fixed",
space = "fixed",
shrink = TRUE,
labeller = "label_value",
drop = TRUE,
strip.position = "top"
)
facet_col(
facets,
scales = "fixed",
space = "fixed",
shrink = TRUE,
labeller = "label_value",
drop = TRUE,
strip.position = "top"
)
}
\arguments{
\item{facets}{A set of variables or expressions quoted by \code{\link[ggplot2:vars]{vars()}}
and defining faceting groups on the rows or columns dimension.
The variables can be named (the names are passed to \code{labeller}).
For compatibility with the classic interface, can also be a
formula or character vector. Use either a one sided formula, \code{~a + b},
or a character vector, \code{c("a", "b")}.}
\item{scales}{Should scales be fixed (\code{"fixed"}, the default),
free (\code{"free"}), or free in one dimension (\code{"free_x"},
\code{"free_y"})?}
\item{space}{Should the size of the panels be fixed or relative to the range
of the respective position scales}
\item{shrink}{If \code{TRUE}, will shrink scales to fit output of
statistics, not raw data. If \code{FALSE}, will be range of raw data
before statistical summary.}
\item{labeller}{A function that takes one data frame of labels and
returns a list or data frame of character vectors. Each input
column corresponds to one factor. Thus there will be more than
one with \code{vars(cyl, am)}. Each output
column gets displayed as one separate line in the strip
label. This function should inherit from the "labeller" S3 class
for compatibility with \code{\link[ggplot2:labeller]{labeller()}}. You can use different labeling
functions for different kind of labels, for example use \code{\link[ggplot2:label_parsed]{label_parsed()}} for
formatting facet labels. \code{\link[ggplot2:label_value]{label_value()}} is used by default,
check it for more details and pointers to other options.}
\item{drop}{If \code{TRUE}, the default, all factor levels not used in the
data will automatically be dropped. If \code{FALSE}, all factor levels
will be shown, regardless of whether or not they appear in the data.}
\item{strip.position}{By default, the labels are displayed on the top of
the plot. Using \code{strip.position} it is possible to place the labels on
either of the four sides by setting \code{strip.position = c("top",
"bottom", "left", "right")}}
}
\description{
These facets are one-dimensional versions of \code{\link[ggplot2:facet_wrap]{ggplot2::facet_wrap()}},
arranging the panels in either a single row or a single column. This
restriction makes it possible to support a \code{space} argument as seen in
\code{\link[ggplot2:facet_grid]{ggplot2::facet_grid()}} which, if set to \code{"free"} will allow the panels to be
sized based on the relative range of their scales. Another way of thinking
about them are one-dimensional versions of \code{\link[ggplot2:facet_grid]{ggplot2::facet_grid()}} (ie.
\code{. ~ {var}} or \code{{var} ~ .}), but with the ability to position the strip at
either side of the panel. However you look at it it is the best of both world
if you just need one dimension.
}
\examples{
# Standard use
ggplot(mtcars) +
geom_point(aes(disp, mpg)) +
facet_col(~gear)
# It retains the ability to have unique scales for each panel
ggplot(mtcars) +
geom_point(aes(disp, mpg)) +
facet_col(~gear, scales = 'free')
# But can have free sizing along the stacking dimension
ggplot(mtcars) +
geom_point(aes(disp, mpg)) +
facet_col(~gear, scales = 'free', space = 'free')
# And you can position the strip where-ever you like
ggplot(mtcars) +
geom_point(aes(disp, mpg)) +
facet_col(~gear, scales = 'free', space = 'free', strip.position = 'bottom')
}
ggforce/man/trans_reverser.Rd 0000644 0001762 0000144 00000001663 14564603706 016015 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trans.R
\name{trans_reverser}
\alias{trans_reverser}
\title{Reverse a transformation}
\usage{
trans_reverser(trans)
}
\arguments{
\item{trans}{A trans object or an object that can be converted to one using
\code{\link[scales:new_transform]{scales::as.trans()}}}
}
\value{
A trans object
}
\description{
While the scales package export a reverse_trans object it does not allow for
reversing of already transformed ranged - e.g. a reverse exp transformation
is not possible. trans_reverser takes a trans object or something coercible
to one and creates a reverse version of it.
}
\examples{
# Lets make a plot
p <- ggplot() +
geom_line(aes(x = 1:10, y = 1:10))
# scales already have a reverse trans
p + scale_x_continuous(trans = 'reverse')
# But what if you wanted to reverse an already log transformed scale?
p + scale_x_continuous(trans = trans_reverser('log'))
}
ggforce/man/position_jitternormal.Rd 0000644 0001762 0000144 00000004522 14304373432 017374 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/position-jitternormal.R
\name{position_jitternormal}
\alias{position_jitternormal}
\title{Jitter points with normally distributed random noise}
\usage{
position_jitternormal(sd_x = NULL, sd_y = NULL, seed = NA)
}
\arguments{
\item{sd_x, sd_y}{Standard deviation to add along the x and y axes. The
function uses \code{\link[stats:Normal]{stats::rnorm()}} with \code{mean = 0} behind the scenes.
If omitted, defaults to 0.15. As with \code{\link[ggplot2:geom_jitter]{ggplot2::geom_jitter()}}, categorical
data is aligned on the integers, so a standard deviation of more than 0.2
will spread the data so it's not possible to see the distinction between
the categories.}
\item{seed}{A random seed to make the jitter reproducible.
Useful if you need to apply the same jitter twice, e.g., for a point and
a corresponding label.
The random seed is reset after jittering.
If \code{NA} (the default value), the seed is initialised with a random value;
this makes sure that two subsequent calls start with a different seed.
Use \code{NULL} to use the current random seed and also avoid resetting
(the behaviour of \pkg{ggplot} 2.2.1 and earlier).}
}
\description{
\code{\link[ggplot2:geom_jitter]{ggplot2::geom_jitter()}} adds random noise to points using a uniform
distribution. When many points are plotted, they appear in a rectangle. This
position jitters points using a normal distribution instead, resulting in
more circular clusters.
}
\examples{
# Example data
df <- data.frame(
x = sample(1:3, 1500, TRUE),
y = sample(1:3, 1500, TRUE)
)
# position_jitter results in rectangular clusters
ggplot(df, aes(x = x, y = y)) +
geom_point(position = position_jitter())
# geom_jitternormal results in more circular clusters
ggplot(df, aes(x = x, y = y)) +
geom_point(position = position_jitternormal())
# You can adjust the standard deviations along both axes
# Tighter circles
ggplot(df, aes(x = x, y = y)) +
geom_point(position = position_jitternormal(sd_x = 0.08, sd_y = 0.08))
# Oblong shapes
ggplot(df, aes(x = x, y = y)) +
geom_point(position = position_jitternormal(sd_x = 0.2, sd_y = 0.08))
# Only add random noise to one dimension
ggplot(df, aes(x = x, y = y)) +
geom_point(
position = position_jitternormal(sd_x = 0.15, sd_y = 0),
alpha = 0.1
)
}
\concept{position adjustments}
ggforce/man/geom_delvor.Rd 0000644 0001762 0000144 00000023220 14564603246 015243 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/voronoi.R
\name{geom_voronoi}
\alias{geom_voronoi}
\alias{geom_delaunay}
\alias{geom_voronoi_tile}
\alias{geom_voronoi_segment}
\alias{geom_delaunay_tile}
\alias{geom_delaunay_segment}
\alias{geom_delaunay_segment2}
\alias{stat_delvor_summary}
\title{Voronoi tesselation and delaunay triangulation}
\usage{
geom_voronoi_tile(
mapping = NULL,
data = NULL,
stat = "voronoi_tile",
position = "identity",
na.rm = FALSE,
bound = NULL,
eps = 1e-09,
max.radius = NULL,
normalize = FALSE,
asp.ratio = 1,
expand = 0,
radius = 0,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_voronoi_segment(
mapping = NULL,
data = NULL,
stat = "voronoi_segment",
position = "identity",
na.rm = FALSE,
bound = NULL,
eps = 1e-09,
normalize = FALSE,
asp.ratio = 1,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_delaunay_tile(
mapping = NULL,
data = NULL,
stat = "delaunay_tile",
position = "identity",
na.rm = FALSE,
bound = NULL,
eps = 1e-09,
normalize = FALSE,
asp.ratio = 1,
expand = 0,
radius = 0,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_delaunay_segment(
mapping = NULL,
data = NULL,
stat = "delaunay_segment",
position = "identity",
na.rm = FALSE,
bound = NULL,
eps = 1e-09,
normalize = FALSE,
asp.ratio = 1,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_delaunay_segment2(
mapping = NULL,
data = NULL,
stat = "delaunay_segment2",
position = "identity",
na.rm = FALSE,
bound = NULL,
eps = 1e-09,
normalize = FALSE,
asp.ratio = 1,
n = 100,
show.legend = NA,
inherit.aes = TRUE,
...
)
stat_delvor_summary(
mapping = NULL,
data = NULL,
geom = "point",
position = "identity",
na.rm = FALSE,
bound = NULL,
eps = 1e-09,
normalize = FALSE,
asp.ratio = 1,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{bound}{The bounding rectangle for the tesselation or a custom polygon
to clip the tesselation to. Defaults to \code{NULL} which creates a rectangle
expanded 10\\% in all directions. If supplied as a bounding box it should be a
vector giving the bounds in the following order: xmin, xmax, ymin, ymax. If
supplied as a polygon it should either be a 2-column matrix or a data.frame
containing an \code{x} and \code{y} column.}
\item{eps}{A value of epsilon used in testing whether a quantity is zero,
mainly in the context of whether points are collinear. If anomalous errors
arise, it is possible that these may averted by adjusting the value of eps
upward or downward.}
\item{max.radius}{The maximum distance a tile can extend from the point of
origin. Will in effect clip each tile to a circle centered at the point with
the given radius. If \code{normalize = TRUE} the radius will be given relative to
the normalized values}
\item{normalize}{Should coordinates be normalized prior to calculations. If
\code{x} and \code{y} are in wildly different ranges it can lead to
tesselation and triangulation that seems off when plotted without
\code{\link[ggplot2:coord_fixed]{ggplot2::coord_fixed()}}. Normalization of coordinates solves this.
The coordinates are transformed back after calculations.}
\item{asp.ratio}{If \code{normalize = TRUE} the x values will be multiplied by this
amount after normalization.}
\item{expand}{A numeric or unit vector of length one, specifying the
expansion amount. Negative values will result in contraction instead. If the
value is given as a numeric it will be understood as a proportion of the
plot area width.}
\item{radius}{As \code{expand} but specifying the corner radius.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{n}{The number of points to create for each segment}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
}
\description{
This set of geoms and stats allows you to display voronoi tesselation and
delaunay triangulation, both as polygons and as line segments. Furthermore
it lets you augment your point data with related summary statistics. The
computations are based on the \code{\link[deldir:deldir]{deldir::deldir()}} package.
}
\section{Aesthetics}{
geom_voronoi_tile and geom_delaunay_tile understand the following aesthetics
(required aesthetics are in bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item alpha
\item color
\item fill
\item linetype
\item size
}
geom_voronoi_segment, geom_delaunay_segment, and geom_delaunay_segment2
understand the following aesthetics (required aesthetics are in bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item alpha
\item color
\item linetype
\item size
}
}
\section{Computed variables}{
stat_delvor_summary computes the following variables:
\describe{
\item{x, y}{If \code{switch.centroid = TRUE} this will be the coordinates for
the voronoi tile centroid, otherwise it is the original point}
\item{xcent, ycent}{If \code{switch.centroid = FALSE} this will be the
coordinates for the voronoi tile centroid, otherwise it will be \code{NULL}}
\item{xorig, yorig}{If \code{switch.centroid = TRUE} this will be the
coordinates for the original point, otherwise it will be \code{NULL}}
\item{ntri}{Number of triangles emanating from the point}
\item{triarea}{The total area of triangles emanating from the point divided
by 3}
\item{triprop}{\code{triarea} divided by the sum of the area of all
triangles}
\item{nsides}{Number of sides on the voronoi tile associated with the point}
\item{nedges}{Number of sides of the associated voronoi tile that is part of
the bounding box}
\item{vorarea}{The area of the voronoi tile associated with the point}
\item{vorprop}{\code{vorarea} divided by the sum of all voronoi tiles}
}
}
\examples{
# Voronoi
# You usually wants all points to take part in the same tesselation so set
# the group aesthetic to a constant (-1L is just a convention)
ggplot(iris, aes(Sepal.Length, Sepal.Width, group = -1L)) +
geom_voronoi_tile(aes(fill = Species)) +
geom_voronoi_segment() +
geom_text(aes(label = after_stat(nsides), size = after_stat(vorarea)),
stat = 'delvor_summary', switch.centroid = TRUE
)
# Difference of normalize = TRUE (segment layer is calculated without
# normalisation)
ggplot(iris, aes(Sepal.Length, Sepal.Width, group = -1L)) +
geom_voronoi_tile(aes(fill = Species), normalize = TRUE) +
geom_voronoi_segment()
# Set a max radius
ggplot(iris, aes(Sepal.Length, Sepal.Width, group = -1L)) +
geom_voronoi_tile(aes(fill = Species), colour = 'black', max.radius = 0.25)
# Set custom bounding polygon
triangle <- cbind(c(3, 9, 6), c(1, 1, 6))
ggplot(iris, aes(Sepal.Length, Sepal.Width, group = -1L)) +
geom_voronoi_tile(aes(fill = Species), colour = 'black', bound = triangle)
# Use geom_shape functionality to round corners etc
ggplot(iris, aes(Sepal.Length, Sepal.Width, group = -1L)) +
geom_voronoi_tile(aes(fill = Species), colour = 'black',
expand = unit(-.5, 'mm'), radius = unit(2, 'mm'))
# Delaunay triangles
ggplot(iris, aes(Sepal.Length, Sepal.Width)) +
geom_delaunay_tile(alpha = 0.3, colour = 'black')
# Use geom_delauney_segment2 to interpolate aestetics between end points
ggplot(iris, aes(Sepal.Length, Sepal.Width)) +
geom_delaunay_segment2(aes(colour = Species, group = -1), size = 2,
lineend = 'round')
}
ggforce/man/geom_sina.Rd 0000644 0001762 0000144 00000022331 14564603706 014705 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sina.R
\name{geom_sina}
\alias{geom_sina}
\alias{stat_sina}
\title{Sina plot}
\usage{
stat_sina(
mapping = NULL,
data = NULL,
geom = "point",
position = "dodge",
scale = "area",
method = "density",
bw = "nrd0",
kernel = "gaussian",
maxwidth = NULL,
adjust = 1,
bin_limit = 1,
binwidth = NULL,
bins = NULL,
seed = NA,
jitter_y = TRUE,
...,
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE
)
geom_sina(
mapping = NULL,
data = NULL,
stat = "sina",
position = "dodge",
...,
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{scale}{How should each sina be scaled. Corresponds to the \code{scale}
parameter in \code{\link[ggplot2:geom_violin]{ggplot2::geom_violin()}}? Available are:
\itemize{
\item \code{'area'} for scaling by the largest density/bin among the different sinas
\item \code{'count'} as above, but in addition scales by the maximum number of points
in the different sinas.
\item \code{'width'} Only scale according to the \code{maxwidth} parameter
}
For backwards compatibility it can also be a logical with \code{TRUE} meaning
\code{area} and \code{FALSE} meaning \code{width}}
\item{method}{Choose the method to spread the samples within the same
bin along the x-axis. Available methods: "density", "counts" (can be
abbreviated, e.g. "d"). See \code{Details}.}
\item{bw}{The smoothing bandwidth to be used.
If numeric, the standard deviation of the smoothing kernel.
If character, a rule to choose the bandwidth, as listed in
\code{\link[stats:bandwidth]{stats::bw.nrd()}}. Note that automatic calculation of the bandwidth does
not take weights into account.}
\item{kernel}{Kernel. See list of available kernels in \code{\link[=density]{density()}}.}
\item{maxwidth}{Control the maximum width the points can spread into. Values
between 0 and 1.}
\item{adjust}{A multiplicate bandwidth adjustment. This makes it possible
to adjust the bandwidth while still using the a bandwidth estimator.
For example, \code{adjust = 1/2} means use half of the default bandwidth.}
\item{bin_limit}{If the samples within the same y-axis bin are more
than \code{bin_limit}, the samples's X coordinates will be adjusted.}
\item{binwidth}{The width of the bins. The default is to use \code{bins}
bins that cover the range of the data. You should always override
this value, exploring multiple widths to find the best to illustrate the
stories in your data.}
\item{bins}{Number of bins. Overridden by binwidth. Defaults to 50.}
\item{seed}{A seed to set for the jitter to ensure a reproducible plot}
\item{jitter_y}{If y is integerish banding can occur and the default is to
jitter the values slightly to make them better distributed. Setting
\code{jitter_y = FALSE} turns off this behaviour}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{orientation}{The orientation of the layer. The default (\code{NA})
automatically determines the orientation from the aesthetic mapping. In the
rare event that this fails it can be given explicitly by setting \code{orientation}
to either \code{"x"} or \code{"y"}. See the \emph{Orientation} section for more detail.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
}
\description{
The sina plot is a data visualization chart suitable for plotting any single
variable in a multiclass dataset. It is an enhanced jitter strip chart,
where the width of the jitter is controlled by the density distribution of
the data within each class.
}
\details{
There are two available ways to define the x-axis borders for the
samples to spread within:
\itemize{
\item{\code{method == "density"}
A density kernel is estimated along the y-axis for every sample group, and
the samples are spread within that curve. In effect this means that points
will be positioned randomly within a violin plot with the same parameters.
}
\item{\code{method == "counts"}:
The borders are defined by the number of samples that occupy the same bin.
}
}
}
\section{Aesthetics}{
geom_sina understand the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item color
\item group
\item size
\item alpha
}
}
\section{Computed variables}{
\describe{
\item{density}{The density or sample counts per bin for each point}
\item{scaled}{\code{density} scaled by the maximum density in each group}
\item{n}{The number of points in the group the point belong to}
}
}
\section{Orientation}{
This geom treats each axis differently and, thus, can thus have two orientations. Often the orientation is easy to deduce from a combination of the given mappings and the types of positional scales in use. Thus, ggplot2 will by default try to guess which orientation the layer should have. Under rare circumstances, the orientation is ambiguous and guessing may fail. In that case the orientation can be specified directly using the \code{orientation} parameter, which can be either \code{"x"} or \code{"y"}. The value gives the axis that the geom should run along, \code{"x"} being the default orientation you would expect for the geom.
}
\examples{
ggplot(midwest, aes(state, area)) + geom_point()
# Boxplot and Violin plots convey information on the distribution but not the
# number of samples, while Jitter does the opposite.
ggplot(midwest, aes(state, area)) +
geom_violin()
ggplot(midwest, aes(state, area)) +
geom_jitter()
# Sina does both!
ggplot(midwest, aes(state, area)) +
geom_violin() +
geom_sina()
p <- ggplot(midwest, aes(state, popdensity)) +
scale_y_log10()
p + geom_sina()
# Colour the points based on the data set's columns
p + geom_sina(aes(colour = inmetro))
# Or any other way
cols <- midwest$popdensity > 10000
p + geom_sina(colour = cols + 1L)
# Sina plots with continuous x:
ggplot(midwest, aes(cut_width(area, 0.02), popdensity)) +
geom_sina() +
scale_y_log10()
### Sample gaussian distributions
# Unimodal
a <- rnorm(500, 6, 1)
b <- rnorm(400, 5, 1.5)
# Bimodal
c <- c(rnorm(200, 3, .7), rnorm(50, 7, 0.4))
# Trimodal
d <- c(rnorm(200, 2, 0.7), rnorm(300, 5.5, 0.4), rnorm(100, 8, 0.4))
df <- data.frame(
'Distribution' = c(
rep('Unimodal 1', length(a)),
rep('Unimodal 2', length(b)),
rep('Bimodal', length(c)),
rep('Trimodal', length(d))
),
'Value' = c(a, b, c, d)
)
# Reorder levels
df$Distribution <- factor(
df$Distribution,
levels(df$Distribution)[c(3, 4, 1, 2)]
)
p <- ggplot(df, aes(Distribution, Value))
p + geom_boxplot()
p + geom_violin() +
geom_sina()
# By default, Sina plot scales the width of the class according to the width
# of the class with the highest density. Turn group-wise scaling off with:
p +
geom_violin() +
geom_sina(scale = FALSE)
}
\author{
Nikos Sidiropoulos, Claus Wilke, and Thomas Lin Pedersen
}
ggforce/man/scale_unit.Rd 0000644 0001762 0000144 00000001251 14564603246 015067 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scale-unit.R
\name{scale_unit}
\alias{scale_x_unit}
\alias{scale_y_unit}
\title{Position scales for units data}
\usage{
scale_x_unit(...)
scale_y_unit(...)
}
\arguments{
\item{...}{Passed on to \code{units::scale_x_unit()} or \code{units::scale_y_unit()}}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} These are the default scales for the units
class. These will usually be added automatically. To override manually, use
\verb{scale_*_unit}.
}
\keyword{internal}
ggforce/man/geom_bspline_closed.Rd 0000644 0001762 0000144 00000012134 14303120026 016714 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bspline_closed.R
\name{geom_bspline_closed}
\alias{geom_bspline_closed}
\alias{stat_bspline_closed}
\alias{geom_bspline_closed0}
\title{Create closed b-spline shapes}
\usage{
stat_bspline_closed(
mapping = NULL,
data = NULL,
geom = "shape",
position = "identity",
na.rm = FALSE,
n = 100,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_bspline_closed(
mapping = NULL,
data = NULL,
stat = "bspline",
position = "identity",
n = 100,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_bspline_closed0(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{n}{The number of points generated for each spline}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
}
\description{
This geom creates closed b-spline curves and draws them as shapes. The
closed b-spline is achieved by wrapping the control points rather than the
knots. The *0 version uses the \code{\link[grid:grid.xspline]{grid::xsplineGrob()}} function with
\code{open = FALSE} and can thus not be manipulated as a shape geom in the same
way as the base version (expand, contract, etc).
}
\section{Aesthetics}{
geom_bspline_closed understand the following aesthetics (required aesthetics
are in bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item color
\item fill
\item linewidth
\item linetype
\item alpha
}
}
\section{Computed variables}{
\describe{
\item{x, y}{The coordinates for the path describing the spline}
\item{index}{The progression along the interpolation mapped between 0 and 1}
}
}
\examples{
# Create 6 random control points
controls <- data.frame(
x = runif(6),
y = runif(6)
)
ggplot(controls, aes(x, y)) +
geom_polygon(fill = NA, colour = 'grey') +
geom_point(colour = 'red') +
geom_bspline_closed(alpha = 0.5)
# The 0 version approximates the correct shape
ggplot(controls, aes(x, y)) +
geom_polygon(fill = NA, colour = 'grey') +
geom_point(colour = 'red') +
geom_bspline_closed0(alpha = 0.5)
# But only the standard version supports geom_shape operations
# Be aware of self-intersections though
ggplot(controls, aes(x, y)) +
geom_polygon(fill = NA, colour = 'grey') +
geom_point(colour = 'red') +
geom_bspline_closed(alpha = 0.5, expand = unit(2, 'cm'))
}
\author{
Thomas Lin Pedersen. The C++ code for De Boor's algorithm has been
adapted from
\href{https://chi3x10.wordpress.com/2009/10/18/de-boor-algorithm-in-c/}{Jason Yu-Tseh Chi implementation}
}
ggforce/man/geom_circle.Rd 0000644 0001762 0000144 00000011657 14303120026 015201 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/circle.R
\name{geom_circle}
\alias{geom_circle}
\alias{stat_circle}
\title{Circles based on center and radius}
\usage{
stat_circle(
mapping = NULL,
data = NULL,
geom = "circle",
position = "identity",
n = 360,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_circle(
mapping = NULL,
data = NULL,
stat = "circle",
position = "identity",
n = 360,
expand = 0,
radius = 0,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{n}{The number of points on the generated path per full circle.}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
\item{expand}{A numeric or unit vector of length one, specifying the
expansion amount. Negative values will result in contraction instead. If the
value is given as a numeric it will be understood as a proportion of the
plot area width.}
\item{radius}{As \code{expand} but specifying the corner radius.}
}
\description{
This set of stats and geoms makes it possible to draw circles based on a
center point and a radius. In contrast to using
\code{\link[ggplot2:geom_point]{ggplot2::geom_point()}}, the size of the circles are related to the
coordinate system and not to a separate scale. These functions are intended
for cartesian coordinate systems and will only produce a true circle if
\code{\link[ggplot2:coord_fixed]{ggplot2::coord_fixed()}} is used.
}
\note{
If the intend is to draw a bubble chart then use
\code{\link[ggplot2:geom_point]{ggplot2::geom_point()}} and map a variable to the size scale
}
\section{Aesthetics}{
geom_circle understand the following aesthetics (required aesthetics are in
bold):
\itemize{
\item \strong{x0}
\item \strong{y0}
\item \strong{r}
\item color
\item fill
\item linewidth
\item linetype
\item alpha
\item lineend
}
}
\section{Computed variables}{
\describe{
\item{x, y}{The start coordinates for the segment}
}
}
\examples{
# Lets make some data
circles <- data.frame(
x0 = rep(1:3, 3),
y0 = rep(1:3, each = 3),
r = seq(0.1, 1, length.out = 9)
)
# Behold some circles
ggplot() +
geom_circle(aes(x0 = x0, y0 = y0, r = r, fill = r), data = circles)
# Use coord_fixed to ensure true circularity
ggplot() +
geom_circle(aes(x0 = x0, y0 = y0, r = r, fill = r), data = circles) +
coord_fixed()
}
\seealso{
\code{\link[=geom_arc_bar]{geom_arc_bar()}} for drawing arcs with fill
}
ggforce/man/geom_diagonal_wide.Rd 0000644 0001762 0000144 00000013027 14303373174 016535 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/diagonal_wide.R
\name{geom_diagonal_wide}
\alias{geom_diagonal_wide}
\alias{stat_diagonal_wide}
\title{Draw an area defined by an upper and lower diagonal}
\usage{
stat_diagonal_wide(
mapping = NULL,
data = NULL,
geom = "shape",
position = "identity",
n = 100,
strength = 0.5,
na.rm = FALSE,
orientation = NA,
show.legend = NA,
inherit.aes = TRUE,
...
)
geom_diagonal_wide(
mapping = NULL,
data = NULL,
stat = "diagonal_wide",
position = "identity",
n = 100,
na.rm = FALSE,
orientation = NA,
strength = 0.5,
show.legend = NA,
inherit.aes = TRUE,
...
)
}
\arguments{
\item{mapping}{Set of aesthetic mappings created by \code{\link[ggplot2:aes]{aes()}}. If specified and
\code{inherit.aes = TRUE} (the default), it is combined with the default mapping
at the top level of the plot. You must supply \code{mapping} if there is no plot
mapping.}
\item{data}{The data to be displayed in this layer. There are three
options:
If \code{NULL}, the default, the data is inherited from the plot
data as specified in the call to \code{\link[ggplot2:ggplot]{ggplot()}}.
A \code{data.frame}, or other object, will override the plot
data. All objects will be fortified to produce a data frame. See
\code{\link[ggplot2:fortify]{fortify()}} for which variables will be created.
A \code{function} will be called with a single argument,
the plot data. The return value must be a \code{data.frame}, and
will be used as the layer data. A \code{function} can be created
from a \code{formula} (e.g. \code{~ head(.x, 10)}).}
\item{geom}{The geometric object to use to display the data, either as a
\code{ggproto} \code{Geom} subclass or as a string naming the geom stripped of the
\code{geom_} prefix (e.g. \code{"point"} rather than \code{"geom_point"})}
\item{position}{Position adjustment, either as a string naming the adjustment
(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a
position adjustment function. Use the latter if you need to change the
settings of the adjustment.}
\item{n}{The number of points to create for each of the bounding diagonals}
\item{strength}{The proportion to move the control point along the x-axis
towards the other end of the bezier curve}
\item{na.rm}{If \code{FALSE}, the default, missing values are removed with
a warning. If \code{TRUE}, missing values are silently removed.}
\item{orientation}{The orientation of the layer. The default (\code{NA})
automatically determines the orientation from the aesthetic mapping. In the
rare event that this fails it can be given explicitly by setting \code{orientation}
to either \code{"x"} or \code{"y"}. See the \emph{Orientation} section for more detail.}
\item{show.legend}{logical. Should this layer be included in the legends?
\code{NA}, the default, includes if any aesthetics are mapped.
\code{FALSE} never includes, and \code{TRUE} always includes.
It can also be a named logical vector to finely select the aesthetics to
display.}
\item{inherit.aes}{If \code{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. \code{\link[ggplot2:borders]{borders()}}.}
\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are
often aesthetics, used to set an aesthetic to a fixed value, like
\code{colour = "red"} or \code{size = 3}. They may also be parameters
to the paired geom/stat.}
\item{stat}{The statistical transformation to use on the data for this
layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the
stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than
\code{"stat_count"})}
}
\description{
The \code{geom_diagonal_wide()} function draws a \emph{thick} diagonal, that is, a
polygon confined between a lower and upper \link[=geom_diagonal]{diagonal}. This
geom is bidirectional and the direction can be controlled with the
\code{orientation} argument.
}
\section{Aesthetics}{
geom_diagonal_wide understand the following aesthetics
(required aesthetics are in bold):
\itemize{
\item \strong{x}
\item \strong{y}
\item \strong{group}
\item color
\item linewidth
\item linetype
\item alpha
\item lineend
}
}
\section{Orientation}{
This geom treats each axis differently and, thus, can thus have two orientations. Often the orientation is easy to deduce from a combination of the given mappings and the types of positional scales in use. Thus, ggplot2 will by default try to guess which orientation the layer should have. Under rare circumstances, the orientation is ambiguous and guessing may fail. In that case the orientation can be specified directly using the \code{orientation} parameter, which can be either \code{"x"} or \code{"y"}. The value gives the axis that the geom should run along, \code{"x"} being the default orientation you would expect for the geom.
}
\examples{
data <- data.frame(
x = c(1, 2, 2, 1, 2, 3, 3, 2),
y = c(1, 2, 3, 2, 3, 1, 2, 5),
group = c(1, 1, 1, 1, 2, 2, 2, 2)
)
ggplot(data) +
geom_diagonal_wide(aes(x, y, group = group))
# The strength control the steepness
ggplot(data, aes(x, y, group = group)) +
geom_diagonal_wide(strength = 0.75, alpha = 0.5, fill = 'red') +
geom_diagonal_wide(strength = 0.25, alpha = 0.5, fill = 'blue')
# The diagonal_wide geom uses geom_shape under the hood, so corner rounding
# etc are all there
ggplot(data) +
geom_diagonal_wide(aes(x, y, group = group), radius = unit(5, 'mm'))
}
ggforce/man/figures/ 0000755 0001762 0000144 00000000000 14564603262 014115 5 ustar ligges users ggforce/man/figures/lifecycle-defunct.svg 0000644 0001762 0000144 00000001704 14276652144 020230 0 ustar ligges users