require('ggtern');
classifydiag.th_hf_nb_wood <- function (wtp_data, ...)
{
ds <- selectNames(wtp_data,c('Name','Th_ppm', 'Hf_ppm', 'Nb_ppm'))
pts <- data.frame(Name=ds$Name,
X = ds$Th_ppm,
Y = ds$Hf_ppm/3,
Z = ds$Nb_ppm/16);
labels <- c("Th", "Hf/3", "Nb/16");
lines <- data.frame(X1 = c(0.15, 0.15, 0.24, 0.56, 0.15, 0.35, 0.08, 0.03, 0.35, 0.54, 0.58, 0.27, 0.13, 0.05, 0.57, 0.63, 0.40, 0.32),
Y1 = c(0.85, 0.77, 0.63, 0.25, 0.77, 0.46, 0.65, 0.87, 0.46, 0.25, 0.20, 0.33, 0.42, 0.55, 0.20, 0.08, 0.12, 0.20),
Z1 = c(0.00, 0.08, 0.13, 0.20, 0.08, 0.19, 0.28, 0.10, 0.19, 0.21, 0.23, 0.40, 0.45, 0.40, 0.23, 0.28, 0.48, 0.48),
X2 = c(0.15, 0.24, 0.56, 0.95, 0.35, 0.08, 0.03, 0.15, 0.54, 0.58, 0.27, 0.13, 0.05, 0.08, 0.63, 0.40, 0.32, 0.27),
Y2 = c(0.77, 0.63, 0.25, 0.00, 0.46, 0.65, 0.87, 0.77, 0.25, 0.20, 0.33, 0.42, 0.55, 0.65, 0.08, 0.12, 0.20, 0.33),
Z2 = c(0.08, 0.13, 0.20, 0.05, 0.19, 0.28, 0.10, 0.08, 0.21, 0.23, 0.40, 0.45, 0.40, 0.28, 0.28, 0.48, 0.48, 0.40));
marks <- data.frame(Label=c("NMORB", "EMORB", "OIB", "Arc-bas"),
X=c(0.17, 0.24, 0.43, 0.60),
Y=c(0.65, 0.43, 0.18, 0.28),
Z=c(0.21, 0.33, 0.39, 0.12));
ret <- c();
ret$type <- "ternogram";
ret$points <- pts;
ret$labels <- labels;
ret$lines <- lines;
ret$marks <- marks;
return(ret);
}