Studying Old Dogs with New Statistical Tricks Part II: Contour Plots and Cracking Bones

Minitab Blog Editor 06 June, 2013

A skull made for cracking some bones! Yesterday I wrote about how paleontologist Zhijie Jack Tseng used 3D surface plots created in Minitab Statistical Software to look at how the skulls of hyenas and some extinct dogs with similar dining habits fit into a spectrum of possible skull forms that had been created with 3D modelling techniques.

What's interesting about this from a data analysis perspective is how Tseng took tools commonly used in quality improvement and engineering and applied them to his research into evolutionary morphology.

We used Tseng's data to demonstrate how to create and explore 3D surface plots yesterday, so let's turn our attention to contour plots. 

How to Create a Contour Plot 

Like a surface plot, we can use a contour plot to look at the relationships between three variables on a single plot. We take two predictor variables (x and y) and use the contour plot to see how they influence a response variable (z).  

A contour plot is like a topographical map in which x-, y-, and z-values substitute for longitude, latitude, and elevation. Values for the x- and y-factors (predictors) are plotted on the x- and y-axes, while contour lines and colored bands represent the values for the z-factor (response). Contour lines connect points with the same response value.

Since skull deepening and widening are major evolutionary trends in bone-cracking dogs and hyaenas, Tseng used skull width-to-length and depth-to-length ratios as variables to examine optimized shapes for two functional properties: mechanical advantage (MA) and strain energy (SE). 

Here's how to use Minitab to create a contour plot like those in Tseng's paper

  1. Download and open the worksheet containing the data.
  2. Choose Graph > Contour Plot.
  3. In Z variable, enter SE (J). In Y variable, enter D:L. In X variable, enter W:L. 
  4. Click OK in the dialog box.

Minitab creates the following graph: 

Contour Plot of Skull Strain Energy

Now, that looks pretty cool...but notice how close the gray and light green bands in the center are?  It would be easier to distinguish them if we had clear dividing lines between the contours.  Let's add them. We'll recreate the graph, but this time we'll click on Data View in the dialog box, and check the option for Contour Lines:

adding contour lines to contour plot

Click OK > OK, and Minitab gives us this plot, which is much easier to scan: 

contour plot with contour lines

Refining and Customizing the Contour Plot

Now, suppose you've created this plot, as we did, with 9 contour levels for the response variable, but you really don't need that much detail?  You can double-click on the graph to bring up the Edit Area dialog box, from which you can adjust the number of levels from 2 through 11.  Here's what the graph looks like reduced to 5 contour levels: 

Contour plot with five levels

Alternatively, we can specify which contour values to display. And if your boss (or funding agency) doesn't like green or blue, it's very easy to change the contour plot's palette. You can also adjust the type of fill used in specific contours:

Contour plot with custom palette and shading


Reading the Contour Plot 

As noted earlier, we read the contour plot as if it were a topographical map: the contours indicate the "steepness" of the response variable, so we can look for: 

  • X-Y "coordinates" that produce maximal or minimal responses in Z
  • Ridges" of high values or "valleys" of low values

It's easy to see from this demonstration why the contour plot is such a popular tool for optimizing processes: it drastically simplifies the task of identifying which values of two predictors lead to the desired values for a response, which would be a bit of a pain to do using just the raw data.

To see how Tseng used contour plots, check out his study: 

Tseng ZJ (2013) Testing Adaptive Hypotheses of Convergence with Functional Landscapes: A Case Study of Bone-Cracking Hypercarnivores. PLoS ONE 8(5): e65305. doi:10.1371/journal.pone.0065305