Learn R Programming

ggtern (version 1.0.1.3)

statTLRline: Add constant lines

Description

In ggplot2, one can add horizontal and vertical lines via the geom_hline and geom_vline prototypes, and these are the analogue in the ternary space, however, they are not 'horizontal' or 'vertical' as such, rather, lines for constant values of one of the three species.

Usage

geom_Tline(mapping = NULL, data = NULL, stat = "Tline",
    position = "identity", show_guide = FALSE, ...)

geom_Lline(mapping = NULL, data = NULL, stat = "Lline", position = "identity", show_guide = FALSE, ...)

geom_Rline(mapping = NULL, data = NULL, stat = "Rline", position = "identity", show_guide = FALSE, ...)

stat_Tline(mapping = NULL, data = NULL, geom = "Tline", position = "identity", Tintercept, ...)

stat_Lline(mapping = NULL, data = NULL, geom = "Lline", position = "identity", Lintercept, ...)

stat_Rline(mapping = NULL, data = NULL, geom = "Rline", position = "identity", Rintercept, ...)

Tline(Tintercept = NULL, ...)

Lline(Lintercept = NULL, ...)

Rline(Rintercept = NULL, ...)

Arguments

Tintercept
for geom_Tline and stat_Tline, the constant value of the THS apex constituent.
Lintercept
for geom_Lline and stat_Lline, the constant value of the LHS apex constituent.
Rintercept
for geom_Rline and stat_Rline, the constant value of the RHS apex constituent.
mapping
The aesthetic mapping, usually constructed with aes or aes_string. Only needs to be set at the layer level if you are overriding the plot defaults.
data
A layer specific dataset - only needed if you want to override the plot defaults.
stat
The statistical transformation to use on the data for this layer.
position
The position adjustment to use for overlappling points on this layer
show_guide
should a legend be drawn? (defaults to FALSE)
...
other arguments passed on to layer. This can include aesthetics whose values you want to set, not map. See layer for more details.
geom
The geometric object to use display the data

Tline, Lline and Rline

Convenience functions, Tline(...), Lline(...) and Rline(...) have been created so that constant lines can be quickly created:

Examples

Run this code
#Base usage
ggtern()  +
 geom_Lline(Lintercept=0.5,color="red") +
 geom_Tline(Tintercept=0.5,color="green") +
 geom_Rline(Rintercept=0.5,color="blue")

#Convenience Functions
ggtern() +
 Tline(0.5,color="red") +
 Lline(0.5,color="green") +
 Rline(0.5,color="blue")

Run the code above in your browser using DataLab