Extends the functionality of 'ggplot2', providing the capability to plot ternary diagrams for (subset of) the 'ggplot2' geometries. Additionally, 'ggtern' has implemented several NEW geometries which are unavailable to the standard 'ggplot2' release. For further examples and documentation, please proceed to the 'ggtern' website.
An extension to ggplot2, for the creation of ternary diagrams.
ggtern is a package that extends the functionality of ggplot2, giving the capability to plot ternary diagrams for (subset of) the
ggplot2 proto geometries. Ternary diagrams are used frequently in a number of disciplines to graph compositional features for mixtures of three different elements or compounds. It is possible to represent a coordinate system having three (3) degrees of freedom, in 2D space, since the third dimention is linear and depends only on the other two.
ggtern is a package that is based on (extends) the very popular
ggplot2, which is an implementation of Wilkinsons The Grammar of Graphics, and, makes provision for a highly methodical construction process for the development of meaningful (graphical) data representations. Of course, the above book by Wilkinson outlines the theory, whilst Hadley Wickhams
ggplot2 implementation is where much of the magic happens, and, an ideal base-platform for
Install the latest release on CRAN, install just like any other R package:
To install the development / working version, use the
Nicholas Hamilton [aut, cre]
This project is licensed under GPL2 - see the LICENSE for details.
Please cite ggtern via the following:
Hamilton NE and Ferry M (2018). "ggtern: Ternary Diagrams Using ggplot2." Journal of Statistical Software, Code Snippets, 87(3), pp. 1-17. doi: 10.18637/jss.v087.c03 (URL:http://doi.org/10.18637/jss.v087.c03)
A bibtex entry can be obtained by executing the following command:
HUGE thanks to Hadley Wickham and all those that have controbuted to the ggplot2 package, without which, this would not be possible.
Ordering of grid rendering was changed relative to the remaining background items
Global tern.clockwise option was created
Changed default procession from anticlockwise to clockwise
Theme nomleclature has been made more like the ggplot2 nomleclature, in the sense that ORIGINAL SUPERCEDED BY ALIASES theme_tern_bw() -> theme_bw() theme_tern_gray() -> theme_gray() theme_grey() theme_tern_rgbg() -> theme_rgbg() theme_rgb() theme_tern_rgbw() -> theme_rgbw()
Theme nomleclature improved for some unique ternary functions. ORIGINAL SUPERCEDED BY ALIASES theme_tern_nogrid_major -> theme_nogrid_major() tern_nogrid_major() theme_tern_nogrid_minor -> theme_nogrid_minor() tern_nogrid_minor() theme_tern_nogrid -> theme_nogrid() tern_nogrid()
Better Documentation for Theme Convenience Functions
In the above themes, they have furthermore been slightly changed to be more consistent with that of ggplot2, in terms of the minor and major colors for the default theme_gray.
Error protocols for version control implemented, same as ggplot2, however, for ggtern.
New theme elements option for putting ticks INSIDE or OUTSIDE of the axis, OUTSIDE is default. Convenience functions also created theme_ticksoutside() and theme_ticksinside()
Clockwise/Anticlockwise axis precession is now controlled by the theme element 'axis.tern.clockwise', as a 'logical'.
Length of theme elements in 'units', such as major and minor ticks.
element_ternary fully depreciated in favour of individual theme elements.
Added functionality for 'secondary ticks' and convenience functions theme_showsecondary(), theme_hidesecondary(), theme_showprimary(), theme_hideprimary()
Correction to logic in .theme_new internal function
Correction to theme_nogrid(), so that it could be 'added' to other themes.
Correction to theme element logic when switching between printing of ggplot2 and ggtern objects.
Ticks rendered after grid, previously it was the other way around, obvious since inside ticks have been introduced.
last_coord set to NULL during onLoad, originally it was set to coord_tern(), which was necessary for the default theme elements, however, is presumptuous in terms of what te user will actually plot.
Correction of padding by aspect ratio, which was introducing small errrors in ticks, noticiable for long tick sizes.
Restructured cood_tern() and how it renderd the ternary elements, distinct functions were broken off from the main render_bg routine.
Correction to throwing points in geom_smooth set, when coordinate limits != c(0,1)
.theme_nocart(), which destroys all cartesian theme elements, is now applied EVERY TIME a ggtern object is rendered. Previously, if a new theme (say theme_bw()) is applied to an EXISTING ggtern plot (ie plot + theme_bw()), some cartesian theme elements were creeping back into the plot.