Mathematica Graphics - 2

Bernd Thaller
Institute of Mathematics
University of Graz
Austria
03-24-1999

Literatur:

Tom Wickham-Jones: Mathematica Graphics - Techniques, Applications. TELOS, Springer Verlag 1994

Stephen Wolfram: The Mathematica book — 4th ed. Wolfram Research, 1999

ContourPlot and DensityPlot

These commands are used for plotting functions f[x,y] of two variables. ContourPlot shows the level sets of the function f, i.e., the solutions x, y of the equation f[x,y]=c for certain values of c. For functions which vary rapidly, DensityPlot with high resolution is more appropriate.

ContourPlot[
      (x^2) + 2 (y^2), {x, -π, π}, {y, -π, π}]

DensityPlot[
      Tan[Cos[x]/Sin[y]], {x, -π, π}, {y, -1, 1}, 
      PlotPoints -> 150, Mesh -> False]

Plot3D

Plot3D generates a three-dimensional surface graphics of a function f[x,y] of two variables.

gr3d  =  
      Plot3D[Sin[x Cos[y]], {x, -π, π}, {y, -π, π}, 
        PlotPoints -> 30]

Note that the graphics objects returned by these plotting commands are  called
⁃ContourGraphics⁃, ⁃DensityGraphics⁃, and ⁃SurfaceGraphics⁃
They all refer to plots of functions of two variables, and can be converted into each other:

Show[ContourGraphics[gr3d]]

dgr = DensityPlot[Abs[Sin[x+ I y]], {x,-Pi,Pi},{y,-1,1.5},PlotPoints->30]

Show[SurfaceGraphics[dgr]]

ColorFunction

DensityPlot[Sin[x^2 + y^2],{x,-Pi,Pi},{y,-Pi,Pi}, PlotPoints->50, Mesh->False,ColorFunction->(Hue[#,#,#]&)]

Note that the values of the function to be plotted are scaled to the interval [0,1] before they are passed as arguments to the colorfunction.