Chapter 8. Three-dimensional plots

 

This chapter covers

  • Basics of three-dimensional plots
  • Generating surface and contour plots
  • Plotting data from a file

In all the plots that we’ve seen so far, we plotted one variable (y) as a function of another one (x). But what if we want to show how some quantity depends on two independent variables? In other words, how can we best visualize a single “output” variable as a function of two “input” variables?

One approach we can take distinguishes the two input variables into the actual independent variable (x) and one parameter. We can then generate a plot showing y as a function of x, for different values of the parameter, as shown in figure 8.1. There, we plot the function

f(x,a) = 0.5*(x**4)/4! + a*(x**2)/2 + x/2 + 2*a
Figure 8.1. Plotting f(x,a) = 0.5*(x**4)/4! + a*(x**2)/2 + x/2 + 2*a for three different values of the parameter a

as a function of x—but for three different values of the parameter a.

Quite often, this method turns out to be sufficient, in particular when there’s a natural distinction between the independent variable and the parameter. For example, in a biology experiment, we may want to study how the size of a cell culture changes over time, but for three different nutrient solutions. This leads naturally to three different curves, one for each choice of nutrient.

8.1. Basics

 
 
 

8.2. Options for surface and contour plots

 
 
 

8.3. Coordinate axes and view point

 

8.4. Plotting data from a file using splot

 
 

8.5. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest