Contour Plots: Definition, Examples

Statistics Definitions > Contour Plots

What are Contour Plots?

Contour plots (sometimes called Level Plots) are a way to show a three-dimensional surface on a two-dimensional plane. It graphs two predictor variables X Y on the y-axis and a response variable Z as contours. These contours are sometimes called z-slices or iso-response values.

This type of graph is widely used in cartography, where contour lines on a topological map indicate elevations that are the same. Many other disciples use contour graphs including: astrology, meteorology, and physics. Contour lines commonly show altitude (like height of a geographical features), but they can also be used to show density, brightness, or electric potential.

A contour plot is appropriate if you want to see how some value Z changes as a function of two inputs, X and Y:
z = f(x,y).

Types

The most common form is the rectangular contour plot, which is (as the name suggests) shaped like a rectangle.

Rectangular contour plot showing a symmetrical surface with a central peak.

Polar contour plots are circular.

Polar plot for the function r sin(θ).

Ternary plots are triangular and show a relationship between three explanatory variables and a response variable. Most commonly, the third explanatory variable is a height value for an XYZ value in ternary space.

Making a Contour Plot

The response variables are extremely complicated to calculate by hand, so they are usually generated by specialized software. SPSS cannot generate these plots, but there are several packages that can, including:

• MATLAB: has several functions including contourf (for a filled 2-D plot) and contour3 (for a 3D plot).
• R: can create a plot with the “filled.contour” command. See this R Documentation for details.
• Excel: can create a very basic chart called a surface chart.
• JMP: click Graph and then Contour Plot. Has a ton of options for levels, data points, colors etc.

Contour plot on JMP. The colored contours make it easier to read. Image: UTK.EDU

------------------------------------------------------------------------------

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.

Comments are now closed for this post. Need help or want to post a correction? Please post a comment on our Facebook page and I'll do my best to help!
Contour Plots: Definition, Examples was last modified: October 12th, 2017 by