Skip to contents

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

Usage

ternary_pyroclastic_size(
  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)

Value

Ternary diagram for pyroclastic rocks based on size in the desired format (object)

Details

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

The ternary diagram for pyroclastic rocks based on size is used in volcanology and sedimentary petrology to classify pyroclastic deposits based on the relative proportions of different grain sizes, specifically blocks and bombs (> 64 mm), lapilli (2-64 mm), and ash (< 2 mm). The diagram helps to infer the eruptive style and depositional processes of volcanic eruptions, as different types of eruptions produce characteristic grain size distributions in the resulting pyroclastic deposits.

Examples

library(ggplot2)
library(plotly)

d = data.frame(lapilli=c(23,40,60),
               bb=c(27,50,30),
               ash=c(50,10,10),
               loc=c("A", "B", "C"))

# adding data to ggplot object
ternary_pyroclastic_size() + geom_point(aes(col = loc), data = d)
#> Ignoring unknown labels:
#>  T : "Blocks & Bombs (> 64 mm)"
#>  L : "Lapilli (2-64 mm)"
#>  R : "Ash (< 2 mm)"


# adding data to plotly object
ternary_pyroclastic_size('plotly') %>%
  add_trace(a = ~bb, b = ~lapilli, c = ~ash,
            data = d,
            name = 'My data',
            type = "scatterternary",
            mode = "markers",
            marker = list(size=8,color='cyan',
                          symbol=3,opacity=.9),
            hovertemplate = paste0('BB: %{a}<br>',
                                   'Lapilli: %{b}<br>',
                                   'Ash: %{c}'))
# adding data to plotly object with custom colors my_pal <- c("A" = "red", "B" = "blue", "C" = "green") my_shapes <- c("A" = "circle", "B" = "square", "C" = "diamond") ternary_pyroclastic_size('plotly') %>% add_trace(a = ~bb, b = ~lapilli, c = ~ash, data = d, type = "scatterternary", mode = "markers", split = ~loc, marker = list(size=8, color = ~my_pal[loc], symbol = ~my_shapes[loc], opacity=.9), hovertemplate = paste0('BB: %{a}<br>', 'Lapilli: %{b}<br>', 'Ash: %{c}'))