How to Make Ternary Plots in R, with ggplot2
When you want to compare between three parts of your data, ternary plots might be a good option. Here is how to make them.
You might not have heard about ternary plots, but in some fields they are quite popular. In chemistry, for example, they are used to show the characteristics of 3-component alloys and 3-component gas mixtures.
In soil sciences, they are ubiquitous. Soils are classified by the fractions of silt, clay and sand:
See Wikipedia for more.
Imagine a soil scientist wanting to classify a soil sample composed of 50 percent clay, 30 percent sand and 20 percent silt. Plotted on a ternary plot, the sample would be placed like this (take note of the colors):
Looking back at the first ternary plot above, you can see that this sample would be classified as a clay soil.
The way countries source energy from fossil fuels, renewables and nuclear energy is another 3-component mixture that lends itself very well to visualization with ternary plots. In this tutorial, you’ll learn how to read ternary plots, and how to make them with ggplot2.
To access this full tutorial and download the source code you must be a member. (If you are already a member, log in here.)
Get instant access to this tutorial and over a hundred more, plus courses, guides, and additional resources.
You'll get unlimited access to hundreds of hours worth of step-by-step visualization courses and tutorials for insight and presentation — all while supporting an independent site. Source code and data is included so that you can more easily apply what you learn in your own work.
The tutorials are very helpful to move from "Oooo, cool!" to how to actually DO the cool.
Members also recieve a weekly newsletter, The Process. Keep up-to-date on visualization tools, the rules, and the guidelines and how they all work together in practice.
See samples of everything you gain access to:
More Tutorials See All →
How to Make a Contour Map
Filled contour plots are useful for looking at density across two dimensions and are often used to visualize geographic data. It’s straightforward to make them in R — once you get your data in the right format, that is.
Drawing Circles and Ellipses in R
Whether you use circles as visual encodings or as a way to highlight areas of a plot, there are functions at your disposal.
How to Make a Heatmap – a Quick and Easy Solution
A heatmap is a literal way of visualizing a table of numbers, where you substitute the numbers with colored cells. This is a quick way to make one in R.