In plutonic rocks, all of the minerals are crystallized into visible grains. The QAP ternary diagram is used to classify igneous rocks with visible mineral grains (phaneritic texture) from their feldspar and quartz content. (c) 2008 Andrew Alden, licensed to ( fair use policy) Polldata <- read.table(“d:/16electiondata.Igneous Rock Classification Diagrams Click the image for a larger version. #Load the data into a table using the read.table function #Enter data into spreadsheet and save a a *csv file
HOW TO READ TERNARY DIAGRAM CODE
The code segment below was used to load the *csv format file: Stein format.īefore working through this tutorial make sure that you have the ggplot, ggplot2, and ggtern packages loaded into your R environment.² I originally created the table shown above using Excel and then converted it into a *cvs format before importing it into R studio for analysis.³ The data can be entered directly via the R data editor as shown in the previous example.
The poll data used in this project were taken from the web site for the time period from July 29 to August 18.¹ It should be noted that the poll numbers were not necessarily from the same polling organization for each date but all polls used were listed as being national in scope with a Clinton v. By plotting the three variables over time on a ternary diagram we can visualize any changes in the mixture of support indicated for the candidates. This results in three variables that are being plotted, the percentage for Clinton (Democrat), Trump (Republican), and for the combined Johnson (Libertarian) and Stein (Green).
In the current presidential election campaign there are the two major party candidates as well as two minor party candidates for the Libertarian and Green parties that are being included in the numerous public opinion polls that are being done nationally.įor purposes of this example I have added the percentages for these two minor parties together. Thu US has a two party dominant system with several minor parties that regularly contest elections. In the next tutorial I will discuss generating a more elaborate ternary diagram using polling data from the current U.S. There are a large number of additions, modifications and tweaks that can be done to this basic pattern. The triangular representation of the dimensions Xa →Xb, Xc → Xa and Xb →Xc allow each case to be represented as a single point located relative to each of the three vectors. Ggtern(data=sampfile, aes(x=Xa,y=Xb, z=Xc)) + geom_point() To produce a very basic ternary diagram with the above data set use the code segment : The number that are entered do not matter for purposes of this illustration. This will open up a data entry sheet with three columns labeled Xa, Xb, and Xc. Sampfile