Learn R Programming

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. 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 with:

install.packages("ggforce")

And the development version from GitHub with:

# 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 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:

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. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('ggforce')

Monthly Downloads

79,209

Version

0.4.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Last Published

February 19th, 2024

Functions in ggforce (0.4.2)

facet_zoom

Facet data for zoom with context
facet_stereo

Create a stereogram plot
facet_matrix

Facet by different data columns
facet_grid_paginate

Split facet_grid over multiple plots
geom_autopoint

A point geom specialised for scatterplot matrices
geom_bspline

B-splines based on control points
geom_diagonal

Draw horizontal diagonals
geom_ellipse

Draw (super)ellipses based on the coordinate system scale
geom_voronoi

Voronoi tesselation and delaunay triangulation
geom_circle

Circles based on center and radius
geom_link

Link points with paths
geom_diagonal_wide

Draw an area defined by an upper and lower diagonal
geom_bspline_closed

Create closed b-spline shapes
geom_bezier

Create quadratic or cubic bezier curves
geom_mark_hull

Annotate areas with hulls
geom_parallel_sets

Create Parallel Sets diagrams
geom_shape

Draw polygons with expansion/contraction and/or rounded corners
geom_mark_rect

Annotate areas with rectangles
geom_mark_circle

Annotate areas with circles
geom_mark_ellipse

Annotate areas with ellipses
GeomShape

ggforce extensions to ggplot2
geom_spiro

Draw spirograms based on the radii of the different "wheels" involved
geom_regon

Draw regular polygons by specifying number of sides
n_pages

Determine the number of pages in a paginated facet plot
scale_depth

Scales for depth perception
radial_trans

Create radial data in a cartesian coordinate system
geom_sina

Sina plot
position_auto

Jitter based on scale types
interpolateDataFrame

Interpolate layer data
power_trans

Create a power transformation object
position_jitternormal

Jitter points with normally distributed random noise
ggforce-package

ggforce: Accelerating 'ggplot2'
theme_no_axes

Theme without axes and gridlines
trans_reverser

Reverse a transformation
label_tex

A labeller function to parse TeX syntax
scale_unit

Position scales for units data
linear_trans

Create a custom linear transformation
stat_err

Intervals in vertical and horizontal directions
facet_wrap_paginate

Split facet_wrap over multiple plots
gather_set_data

Tidy data for use with geom_parallel_sets
geom_arc_bar

Arcs and wedges as polygons
geom_autodensity

A distribution geoms that fills the panel and works with discrete and continuous data
geom_arc

Arcs based on radius and radians
facet_row

One-dimensional facets