Ternary plots are often used in geological data (mineral chemistry, whole-rock chemistry etc.). But it is a bit difficult to make ternary plots using excel.
R package ('ggtern') by Nicholas Hamilton help us make ternary plots easily!
‘ggtern’ is a software package for the statistical computing language R. It is an extension to ggplot2 [1] specifically for the plotting of ternary diagrams.
Library
library(ggtern) library(MetBrewer)Read data
This time, I use compiled data of residual abyssal peridotites from Warren (2016).
mode <- read.csv("/Pathname of file HERE!!/residual_abyssal_peridotites.csv")Check the dataset
head(mode)## Sample Lat Long Depth FSR Ridge Location Lithology Type
## 1 DMM-WH05 NA NA NA NA DMM DMM DMM NA
## 2 SO80-83-20 -24.24 -115.69 4200 156.88 EPR Terevaka TF Harz 1
## 3 SO80-83-28 -24.24 -115.69 4200 156.88 EPR Terevaka TF Harz 1
## 4 SO80-83-43 -24.24 -115.69 4200 156.88 EPR Terevaka TF Harz 1
## 5 SO80-83-43 -24.24 -115.69 4200 156.88 EPR Terevaka TF Harz 1
## 6 SO12-91D-7-3 -13.48 -111.49 4616 149.85 EPR Garrett TF Harz 1
......Visualizing the mineral modal abundances of abyssal peridotites
Peridotites consist mostly of olivine (OL), orthopyroxene (OPX) and clinopyroxene (CPX).
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point()
plot(p)
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point()
plot(p)Change the size, color (Ridge) and shape (Lithology)
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=Ridge, shape=Lithology))
plot(p)Restrict Ternary Limit
Peridotite is an ultramafic rock containing more than 40% olivine (OL).
I show only the area of peridotites.
Limit tern_limits()
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=Ridge, shape=Lithology))
p <- p + tern_limits(T=1,L=0.6,R=0.6)
plot(p)Setting theme and shapes
Color scale_shape_manual()
Theme theme_bw()
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=Ridge, shape=Lithology))
p <- p + tern_limits(T=1,L=0.6,R=0.6)
p <- p + scale_shape_manual(values = c("DMM" = 16,
"Lherz" = 15,
"Harz"= 17,
"Perid"= 18))
p <- p + theme_bw()
plot(p)Setting color and adding the title of figure
Color scale_colour_manual()
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=Ridge, shape=Lithology))
p <- p + tern_limits(T=1,L=0.6,R=0.6)
p <- p + theme_bw()
p <- p + scale_colour_manual(values = c("AAR" = "green4",
"EPR" = "sienna4",
"CIR" = "orangered1",
"MAR" = "orange1",
"SWIR" = "royalblue4",
"LT" = "lightskyblue3",
"GAK" = "royalblue1",
"DMM" = "black"))
p <- p + scale_shape_manual(values = c("DMM" = 16,
"Lherz" = 15,
"Harz"= 17,
"Perid"= 18))
p <- p + labs(title="Mineral Mode")
plot(p)
Linear Regression (Ternary plot)
geom_smooth_tern(method=lm)
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=Ridge, shape=Lithology))
p <- p + geom_smooth_tern(method=lm)
p <- p + tern_limits(T=1,L=0.6,R=0.6)
p <- p + theme_bw()
p <- p + scale_colour_manual(values = c("AAR" = "green4",
"EPR" = "sienna4",
"CIR" = "orangered1",
"MAR" = "orange1",
"SWIR" = "royalblue4",
"LT" = "lightskyblue3",
"GAK" = "royalblue1",
"DMM" = "black"))
p <- p + scale_shape_manual(values = c("DMM" = 16,
"Lherz" = 15,
"Harz"= 17,
"Perid"= 18))
p <- p + labs(title="Mineral Mode")
plot(p)Change color (brewer)
scale_color_brewer(palette = "RdYlBu")
#locality
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=Ridge, shape=Lithology))
p <- p + geom_smooth_tern(method=lm)
p <- p + tern_limits(T=1,L=0.6,R=0.6)
p <- p + scale_color_brewer(palette = "RdYlBu")
p <- p + scale_shape_manual(values = c("DMM" = 16,
"Lherz" = 15,
"Harz"= 17,
"Perid"= 18))
p <- p + theme_bw()
p <- p + labs(title="Mineral Mode")
plot(p)Changing color value (numeric value)
I apply color using Cr# of spinel (CrSPL).
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=CrSPL, shape=Lithology))
p <- p + tern_limits(T=1,L=0.6,R=0.6)
p <- p + scale_shape_manual(values = c("DMM" = 16,
"Lherz" = 15,
"Harz"= 17,
"Perid"= 18))
p <- p + theme_bw()
p <- p + labs(title="Mineral Mode")
plot(p)Setting color gradient
p <- ggtern(data = mode, aes(OPX,OL,CPX))
p <- p + geom_point(size= 2, aes(colour=CrSPL, shape=Lithology))
p <- p + tern_limits(T=1,L=0.6,R=0.6)
p <- p + scale_colour_gradient2(
low = "deepskyblue1",
mid = "grey50",
high = "brown1",
midpoint = 30,
na.value = "white",
)
p <- p + scale_shape_manual(values = c("DMM" = 16,
"Lherz" = 15,
"Harz"= 17,
"Perid"= 18))
p <- p + theme_bw()
p <- p + labs(title="Mineral Mode")
plot(p)In 'ggtern' website, we can read detailed descriptions and instructions of the package.
There are many functions such as density map, interpolation etc.










0 Comments