Learn R Programming

ggtern (version 1.0.5.0)

TLRWlab: Change Axis labels and legend titles

Description

New label modification functions, equivalent to the original functions in ggplot2 (xlab and ylab) however for the new axes used in the ggtern package

Tlab modifies the label of the TOP apex species

Llab modifies the label of the LHS apex species

Rlab modifies the label of the RHS apex species

Wlab modifies the label of the arrow suffix

Usage

Tlab(label)

Llab(label)

Rlab(label)

Wlab(label)

zlab(label)

Arguments

label
the desired label, usually as a character or expression, although other values can be inputed (such as, for example, scalar

Arrow Label Suffix

Wlab changes the ternary arrow suffix (ie atomic percent, weight percent etc) when the ternary arrows are enabled (see theme_showarrows and weight_percent)

Precedence

AAAlab takes precedence over BBBlab (where AAA represents T, L or R and BBB represents x, y or z)

Use of Expressions

Expressions can be used in the labels, in the event that the user wishes to render formula, subscripts or superscripts, see the last example below.

Creation of Aliasses

Aliasses exist for Tlab, Llab, Rlab and Wlab, which are tlab, llab, rlab and wlab. These aliasses produce an identical result, and are there for convenience (as opposed to having an error thrown) in the event that the user forgets to use an upper-case letter.

Details

Tlab and xlab are equivalent (when T='x' in the coord_tern definition), as is Llab and ylab (when L='y') , and Rlab and zlab (when R='z'), for other assignments when coord_tern is defined, the equivalence is not the case, however, if T='XXX', then Tlab will be the same as XXXlab (where XXX can be substituted for 'x', 'y' or 'z', and likewise for Llab and Rlab).

zlab is new to ggtern, but is intended to be an analogous to xlab and ylab as per the definitions in ggplot2.

See Also

ggplot2 labs

Examples

Run this code
data(Feldspar)
plot <- ggtern(data=Feldspar,aes(Ab,An,Or)) +  geom_point() +
        xlab("ABC") + ylab("DEF") + zlab("GHI")

#Alternatives, and Arrow Label
plot + Tlab("TOP") + Llab("LHS") + Rlab("RHS") +
  theme_showarrows() + Wlab("WEIGHT")

Run the code above in your browser using DataLab