Draw Label at Relative Position on Viewport
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 label-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.
geom_label_viewport(mapping = NULL, data = NULL, stat = "identity", position = "identity", ..., hjust = "inward", vjust = "inward", parse = FALSE, label.padding = unit(0.25, "lines"), label.r = unit(0.15, "lines"), label.size = 0.25, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE)
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, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
hjust |
horizontal justification |
vjust |
vertical justification |
parse |
If |
label.padding |
Amount of padding around label. Defaults to 0.25 lines. |
label.r |
Radius of rounded corners. Defaults to 0.15 lines. |
label.size |
Size of label border, in mm. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom_Label
understands the following aesthetics (required aesthetics are in bold):
label
x
y
alpha
angle
colour
family
fill
fontface
hjust
lineheight
size
vjust
Nicholas Hamilton
library(ggplot2) data(Feldspar) base = ggtern(data=Feldspar,aes(Ab,An,Or)) + geom_mask() + geom_point() + geom_label_viewport(x=0.5,y=0.5,label="Middle",color='red') + geom_label_viewport(x=1.0,y=1.0,label="Top Right",color='blue') + geom_label_viewport(x=0.0,y=0.0,label="Bottom Left",color='green') + geom_label_viewport(x=0.0,y=1.0,label="Top Left",color='orange') + geom_label_viewport(x=1.0,y=0.0,label="Bottom Right",color='magenta') base base + geom_label_viewport(x=0.9,y=0.5,label="Clipping Turned Off",color='purple',hjust=0,clip='on') base + geom_label_viewport(x=0.9,y=0.5,label="Clipping Turned Off",color='purple',hjust=0,clip='off')
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.