ternary_qap_g()
draws either a static or interactive ternary diagram, in english or spanish. It is a base diagram where data can be plotted.
ternary_qap_g( output = c("ggplot", "plotly"), language = c("en", "es"), opacity = 0.5 )
output | The output format: "ggplot" or "plotly" (default is "ggplot") |
---|---|
language | The language to be displayed: "en" for english or "es" for spanish (deafult is "en") |
opacity | Transparency level (default is 0.5) |
QAP ternary diagram for gabbroic rocks in the desired format (object)
For plotting data on the ggplot object it would be easier if the names of the dataframe are "cpx", "p", and "opx", that way it gets mapped automatically, if not make sure to use "aes(x=cpx,y=p,z=opx)".
For plotting on the plotly object the mapping of the new data should be as shown in the example: a = ~p, b = ~cpx, c = ~opx
, where a
refers to the top ("p"), b
refers to the bottom left ("cpx"), and c
refers to the bottom right ("opx").
The examples show basic usage and how to add data, which can be more customizable.
library(ggplot2) library(plotly) d = data.frame(p=c(23,26.9,25.3), cpx=c(27,23.7,5.1), opx=c(50,49.4,59.6)) # adding data to ggplot object ternary_qap_g() + geom_point(data = d)