geom_text_viewport {ggtern} | R Documentation |
Draw Text at Relative Position on Viewport
Description
Since it is sometimes counter intuitive for working with ternary or other non-cartesian coordinates in the event that the the user wishes to place a text-geometry based on visual inspection, this geometry positions such text item at a fraction from x=[0,1] and y=[0,1] of the viewport in x and y cartesian coordinates.
Usage
geom_text_viewport(
mapping = NULL,
data = NULL,
stat = "identity",
position = "identity",
...,
hjust = "inward",
vjust = "inward",
parse = FALSE,
check_overlap = FALSE,
na.rm = FALSE,
show.legend = NA,
inherit.aes = TRUE
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this
layer, either as a |
position |
Position adjustment, either as a string naming the adjustment
(e.g. |
... |
Other arguments passed on to |
hjust |
horizontal justification |
vjust |
vertical justification |
parse |
If |
check_overlap |
If |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
Aesthetics
geom_Text
understands the following aesthetics (required aesthetics are in bold):
label
x
y
alpha
angle
colour
family
fontface
hjust
lineheight
size
vjust
Author(s)
Nicholas Hamilton
See Also
Examples
library(ggplot2)
data(Feldspar)
base = ggtern(data=Feldspar,aes(Ab,An,Or)) +
geom_mask() +
geom_point() +
geom_text_viewport(x=0.5,y=0.5,label="Middle",color='red') +
geom_text_viewport(x=1.0,y=1.0,label="Top Right",color='blue') +
geom_text_viewport(x=0.0,y=0.0,label="Bottom Left",color='green') +
geom_text_viewport(x=0.0,y=1.0,label="Top Left",color='orange') +
geom_text_viewport(x=1.0,y=0.0,label="Bottom Right",color='magenta')
base
base +
geom_text_viewport(x=0.9,y=0.5,label="Clipping Turned Off",color='purple',hjust=0,clip='on')
base +
geom_text_viewport(x=0.9,y=0.5,label="Clipping Turned Off",color='purple',hjust=0,clip='off')