ternary_qtfl: QtFL Ternary Diagram for Provenance Analysis

View source: R/ternary_qtfl.R

ternary_qtflR Documentation

QtFL Ternary Diagram for Provenance Analysis

Description

ternary_qtfl() draws either a static or interactive ternary diagram, in english or spanish. It is a base diagram where data can be plotted.

Usage

ternary_qtfl(
  output = c("ggplot", "plotly"),
  language = c("en", "es"),
  opacity = 0.5
)

Arguments

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)

Details

For plotting data on the ggplot object it would be easier if the names of the dataframe are "f", "qt", and "l", that way it gets mapped automatically, if not make sure to use "aes(x=f,y=qt,z=l)". For plotting on the plotly object the mapping of the new data should be as shown in the example: a = ~qt, b = ~f, c = ~l, where a refers to the top ("qt"), b refers to the bottom left ("f"), and c refers to the bottom right ("l"). The examples show basic usage and how to add data, which can be more customizable.

Value

QtFL ternary diagram for provenance analysis in the desired format (object)

Examples

library(ggplot2)
library(plotly)

d = data.frame(qt=c(23,26.9,25.3),
               f=c(27,23.7,5.1),
               l=c(50,49.4,59.6))

# adding data to ggplot object
ternary_qtfl() + geom_point(data = d)

# adding data to plotly object
ternary_qtfl('plotly') %>%
  add_trace(a = ~qt, b = ~f, c = ~l,
            data = d,
            name = 'My data',
            type = "scatterternary",
            mode = "markers",
            marker = list(size=8,color='coral',symbol=3,opacity=.9),
            hovertemplate = paste0('Qt: %{a}<br>',
                                   'F: %{b}<br>',
                                   'L: %{c}'))


maxgav13/GMisc documentation built on June 12, 2022, 3:48 a.m.