ggtern_labels: Change Axis labels and legend titles

Description Usage Arguments Details Arrow Label Arrow Label Suffix Precedence Use of Expressions Creation of Aliasses Author(s) See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Tlab(label, labelarrow = label)

Llab(label, labelarrow = label)

Rlab(label, labelarrow = label)

Wlab(label)

zlab(label)

Tarrowlab(label)

Larrowlab(label)

Rarrowlab(label)

Arguments

label

the desired label

labelarrow

the desired label, if different to label, for the markers along the procession arrows

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.

Arrow Label

Tarrowlab, Larrowlab and Rarrowlab permits setting a different label to the apex labels.

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.

Arguments for these functions can be provided as a character or expression, although other values can be inputed (such as, for example, scalar numeric or logical). ggtern also imports the latex2exp package, and these formats can be parsed too.

Author(s)

Nicholas Hamilton

See Also

ggplot2 labs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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") + 
  Tarrowlab("Top Arrow Label") + Larrowlab("Left Arrow Label") + Rarrowlab("Right Arrow Label") +
  theme_showarrows() + Wlab("WEIGHT")

#Demonstrate the use of the latex2exp integration, and seperate arrow labels.  
ggtern(data=Feldspar,aes(x=Ab,y=An,z=Or)) + 
labs( x       = "NaAlSi_3O_8",
      xarrow  = "Albite, NaAlSi_3O_8",
      y       = "(Na,K)AlSi_3O_8",
      yarrow  = "Anorthite (Na,K)AlSi_3O_8",
      z       = "KAlSi_3O_8",
      zarrow  = "Orthoclase KAlSi_3O_8") + 
theme_latex(TRUE) + 
geom_point() + 
theme_showarrows() + 
theme_clockwise() + 
weight_percent()

Example output

Loading required package: ggplot2
--
Consider donating at: http://ggtern.com
Even small amounts (say $10-50) are very much appreciated!
Remember to cite, run citation(package = 'ggtern') for further info.
--

Attaching package: 'ggtern'

The following objects are masked from 'package:ggplot2':

    %+%, aes, annotate, calc_element, ggplot, ggplotGrob, ggplot_build,
    ggplot_gtable, ggsave, layer_data, theme, theme_bw, theme_classic,
    theme_dark, theme_gray, theme_light, theme_linedraw, theme_minimal,
    theme_void

ggtern documentation built on Nov. 6, 2018, 5:07 p.m.