To demonstrate the capability of this package, here is an example of a materials application for the Zirconia, Alumina, Silica system via reproducing the results depicted in the work by Sorrell and Sorrell [1]. Lets firstly present the result prior to presenting the code/method on how it was produced.

Case Study Final Output:

The Final Product

The Final Product

Procedures to Achieve the Above:

  1. Data preparation, and,
  2. Construction of the plot by progressively adding layers.

Keep reading for details on each…

Data Preparation:

The first step is to input the data points, from the paper, we have explicit data points, phase lines, text labels etc.

#Input the data 24 points in total.
df <- data.frame(Al2O3   = c(0, 5,10,10,2,2,1,1,3,2,1,3,1,3,
ZrO2    = c(2,40,40,45,2,2,2,2,2,2,2,2,0,0,
SiO2    = c(2,55,50,45,2,0,2,3,2,3,4,3,2,2,
Al2O3end= NA, ZrO2end = NA, SiO2end = NA, #FOR USE LATER
Group   = c(rep("Data",14),       #First 14 pts are 'Data'
rep("Compound",3),    #Next   3 'Compound info'
rep("Phase",3),       #Next   3 phase labels
rep("BndApprxBC",2),  #Next   2 BC Boundary
rep("BndApprxAB",2)), #Final  2 AB Boundary
label   = c("Zircon",
phase   = c("A",rep("B",8),rep("C",5),
hjust   = c(1.1,rep(NA,12),-0.1,rep(NA,10)),
vjust   = c(-0.75,rep(-0.75,12),-0.75,rep(NA,10)),
linetype= NA)

Create the paths based on start and finish indexes in the above dataset.

#Create the path indexes & data
df.paths     <- data.frame(id.start=c(16,14,1,21,23),
id.end  =c(14,1,15,22,24),
df.paths.res <- cbind(df[df.paths$id.start,c(1:3)],df[df.paths$id.end,c(1:3)])
colnames(df.paths.res)[4:6] <- paste(colnames(df.paths.res)[4:6],"end",sep="")
#Ensure the same columns exist prior to merging.
df.paths.res$Group    = c(rep("Paths",3),rep("Boundaries",2))
df.paths.res$label    = ""
df.paths.res$linetype = df.paths$linetype
df.paths.res$hjust    = NA
df.paths.res$vjust    = NA
df.paths.res$phase    = c("AC","CA","AC","BC","AB")

Merge the two sets to create a master dataframe.

#Combine the data and the paths into one dataframe
df <- rbind(df,df.paths.res)

Construct the data labels as a function of compositions (ie A-B-C)

df$phaselab <- paste(df$Al2O3,df$ZrO2,df$SiO2,sep="-")

Plot Construction:

If you are familiar with ggplot2, this next section should make complete sense.

#Build the plot
ggtern(data=df[which(df$Group=="Data"),],aes(x=SiO2,y=ZrO2,z=Al2O3)) +
#Field Segments
linetype=factor(linetype)),size=1) +
#Boundary Segments
linetype=factor(linetype),color=Group),size=1.25) +
#The Data Points
geom_point(size=4,shape=21,aes(color=Group,fill=phase)) + 
#ABC Markers
aes(fill=phase),size=8,shape=21) +
geom_text(data =df[which(df$Group =="Phase"),],
aes(label=label)) +
#The Data Labels
geom_text(aes(label=label,hjust=hjust),vjust=1.0) +
size=3,color="gray20") +
#Theme tweaks
theme_tern_rgbw() +
legend.justification=c(0,1),"left") +
axis.tern.title.L=element_text(hjust=1.1)) +
#Arrow Suffix
custom_percent("Mol %") +
#Formatting / Layout
labs(title="The ZrO2-Al2O3-SiO2 System",
fill="Phases") +
guides(linetype="none") +

which produces the result at the top of the page, however, if your flavor is something more ‘traditional’…

A More Traditional Appearance:

last_plot() + theme_tern_bw()     + 
theme_tern_nogrid() + 
A More Traditional Theme

A More Traditional Theme

For the full script to the above, click HERE.


[1] [doi] C. A. Sorrell and C. C. Sorrell, “Subsolidus Equilibria and Stabilization of Tetragonal ZrO2 in the System ZrO2-Al2O3-SiO2,” Journal of the American Ceramic Society, vol. 60, iss. 11-12, pp. 495-499, 1977.
Title = {Subsolidus Equilibria and Stabilization of Tetragonal ZrO2 in the System ZrO2-Al2O3-SiO2},
Author = {Sorrell, Charles A and Sorrell, Charles C},
Journal = {Journal of the American Ceramic Society},
Year = {1977},
Number = {11-12},
Pages = {495--499},
Volume = {60},
Doi = {10.1111/j.1151-2916.1977.tb14090.x},
Owner = {Nick Hamilton},
Publisher = {Wiley Online Library},
Timestamp = {20131221}