This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / The Mathematica Book / Practical Introduction / Graphics and Sound  /

1.9.8 Converting between Types of Graphics

Contour, density and surface plots are three different ways to display essentially the same information about a function. In all cases, you need the values of a function at a grid of points.
The Mathematica functions ContourPlot, DensityPlot and Plot3D all produce Mathematica graphics objects that include a list of the values of your function on a grid. As a result, having used any one of these functions, Mathematica can easily take its output and use it to produce another type of graphics.

  • Here is a surface plot.
  • In[1]:= Plot3D[BesselJ[nu, 3x], {nu, 0, 3}, {x, 0, 3}]

  • This converts the object produced by Plot3D into a contour plot.
  • In[2]:= Show[ ContourGraphics[ % ] ]

    Conversions between types of graphics.

  • You can use GraphicsArray to show different types of graphics together.
  • In[3]:= Show[ GraphicsArray[ {%, %%} ] ]