Announcing ggforce: Accelerating ggplot2
November 22, 2016
I am very pleased to announce the first release of the ggforce
package.
ggforce
is a general ggplot2
extension package in the same vein as ggalt
with no overarching goal
other than to provide additional functionality to the ggplot2
universe. The
inception and birth of ggforce was documented in a recent
post and the road to CRAN has
been long and winding, with my personal goal of the package going through
multiple iterations. At the beginning it was meant as a place where everyone
could submit extensions to. As I began working on
ggraph
it became a dumping ground for
functionality that was broader than network visualization, and as I began
working on ggplot2
it became a testing ground for new facetting functions.
Now, as it is ready for CRAN, it does include some requests and code from other
developers, thus paying partial homage to the founding goal of the package.
This post will not go into detail with every functionality that ggforce adds to
ggplot2
. ggforce
includes a
vignette
where every feature is described along with motivation and code examples.
Features
Below follows a description of all the major features (small utility functions are not included), grouped by the grammar they extend:
Geoms
geom_arc()
allows you to plot circle segments defined by center, radius, and start- and end-angle.geom_arc_bar()
is as above, except it draws a thick arc defined by an inner and outer radius. If the inner radius is zero it becomes a wedge.
geom_circle()
makes it possible to draw circles based on coordinate space, that is, the radius is scaled to the coordinate system rather than absolute.geom_link()
is likegeom_segment()
except it expands the line into multiple segments making it possible to draw gradients over the line.geom_bezier()
allows you to draw cubic and quadratic beziers.
geom_bspline()
makes it possible to draw b-splines.geom_sina()
is a novel alternative togeom_violin()
/geom_boxplot()
/geom_jitter()
that was submitted to ggforce by the developers of sinaplot
Scales
scale_[x|y]_unit()
provides support for the units class from the units package. It provides automatical labelling of axis with units as well as changing the units of the scale without touching the data.
Facets
facet_[grid|wrap]_paginate()
allows you to split grid and wrap facetting out into multiple pages.facet_zoom()
is a third zooming alternative that provides a context overview.
Transformations
While transformations are part of the scales
package rather than ggplot2
their use is integral to ggplot2
, and ggforce
thus fills some gaps in this
department as well.
power_trans()
lets you create any power transformation (scales
only providessqrt_trans()
).radial_trans()
lets you translate between coordinates specified by radius and angle and coordinates specified by x and y.trans_reverser()
reverses any monotonous transformation function, making it possible to e.g. have a reversed log transformation (scales
only providesreverse_trans()
for reversing the identity transformation).
Future
I have many cool ideas planned for future releases, and I hope that users will
approach me if they have some great ideas as well. If you have a burning wish
for something in the ggplot2
ecosystem I welcome any issues and PRs on the
ggforce
github repository. The
ggplot2
ecosystem is thriving though so please visit
http://www.ggplot2-exts.org and see if your idea doesn’t already exist in
another package.
Happy plotting!