This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)


generates a contour plot of f as a function of x and y.
plots contour lines for which .
plots several contour lines.
  • ContourPlot by default generates colorized grayscale output, in which larger values are shown lighter.
  • At positions where f does not evaluate to a real number, holes are left so that the background to the contour plot shows through.
  • ContourPlot has attribute HoldAll, and evaluates the and only after assigning specific numerical values to x and y.
  • In some cases it may be more efficient to use Evaluate to evaluate the and symbolically before specific numerical values are assigned to x and y.
  • The plot is left blank in any regions where f evaluates to None.
AspectRatio1ratio of height to width
BoundaryStyleNonehow to draw RegionFunction boundaries
BoxRatiosAutomaticeffective 3D bounding-box ratios
ClippingStyleNonehow to draw values clipped by PlotRange
ColorFunctionAutomatichow to color regions between contour lines
ColorFunctionScalingTruewhether to scale the argument to ColorFunction
ContourLabelsAutomatichow to label contour levels
ContoursAutomatichow many or what contours to use
ContourShadingAutomatichow to shade regions between contours
ContourStyleAutomaticthe style for contour lines
EvaluationMonitorNoneexpression to evaluate at every function evaluation
ExclusionsAutomatic curves to exclude
ExclusionsStyleNonewhat to draw at excluded curves
FrameTruewhether to put a frame around the plot
FrameTicksAutomaticframe tick marks
LightingAngleNoneeffective angle of the simulated light source
MaxRecursionAutomaticthe maximum number of recursive subdivisions allowed
MeshNonehow many mesh lines in each direction to draw
MeshFunctions{}how to determine the placement of mesh lines
MeshStyleAutomaticthe style for mesh lines
MethodAutomaticthe method to use for refining contours
PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
PlotPointsAutomaticthe initial number of sample points in each direction
PlotRange{Full,Full,Automatic}the range of f or other values to include
PlotRangeClippingTruewhether to clip at the plot range
PlotRangePaddingAutomatichow much to pad the range of values
RegionFunction(True&)how to determine whether a point should be included
WorkingPrecisionMachinePrecisionthe precision used in internal computations
  • ContourPlot superimposes the contour lines associated with all of the equalities .
  • ContourPlot initially evaluates f at a grid of equally spaced sample points specified by PlotPoints. Then it uses an adaptive algorithm to subdivide at most MaxRecursion times to generate smooth contours.
  • You should realize that since it uses only a finite number of sample points, it is possible for ContourPlot to miss features of your functions. To check your results, you should try increasing the settings for PlotPoints and MaxRecursion.
  • With some settings for PerformanceGoal, other specific option settings may be overridden.
  • ColorFunction is supplied with a single argument, given by default by the average of the scaled values of f for each pair of successive contour levels.
  • With the default settings Exclusions->Automatic and ExclusionsStyle->None, ContourPlot breaks continuity in its sampling at any discontinuity curve it detects. The discontinuity is immediately visible only if it jumps out of a particular contour level.
Plot the contours of a function:
Plot an equation:
Plot several equations:
Plot the contours of a function:
Click for copyable input
Plot an equation:
Click for copyable input
Plot several equations:
Click for copyable input
More points are sampled where the function changes quickly:
The plot range is selected automatically:
Areas where the function becomes nonreal are excluded:
The surface is split when there are discontinuities in the function:
Use PlotPoints and MaxRecursion to control adaptive sampling:
Use PlotRange to focus in on areas of interest:
Use Exclusions to remove curves or split the resulting surface:
Use RegionFunction to restrict the surface to a region given by inequalities:
Add labels:
Color the surface by height:
Label the contours:
Use specific colors between contours:
Use different styles for the contours:
Show multiple implicit curves, with styles chosen automatically:
Explicitly set the style for contours:
Create an overlay mesh:
By default the AspectRatio is 1:
Use an Automatic setting to get the natural ratio:
Draw both and axes:
Use a black boundary around the edges of the surface:
Use a red boundary around the edges of the surface:
Use a thick red boundary around the edges of the surface:
BoundaryStyle applies to holes cut by RegionFunction:
BoundaryStyle does not apply to cuts made by Exclusions:
Use ExclusionsStyle instead:
Show clipped regions like the rest of the surface:
Leave clipped regions empty:
Use pink to fill the clipped regions:
Use light red where the surface is clipped above and pink below:
Color by scaled coordinate:
Named color gradients color in the direction:
Make everything red above a contour at :
Color with blue if contour values are negative, with red otherwise:
Add labels to contour lines:
Label with values in frames:
ContourLines is superseded by ContourStyle:
Use 10 equally spaced contours:
Use automatic contour selection:
Use at most 5 automatically selected contours:
Use specific contours:
Use specific contours with specific styles:
Use a function to generate a set of contours:
Have contours at the 10% and 90% percentile values:
The automatic shading is darker at low values and lighter at high values:
Use None to only show the contour lines:
Shade between contours using a color function:
Use an explicit list of colors between contours:
The default contour style is a partially transparent line:
Use black contour lines:
Use None to not show contour lines:
Alternate between red and dashed contour lines:
Use dashed red contour lines:
Use different styles for different equations:
Use dashed red lines for all the equations:
Show where ContourPlot samples a function:
Count how many times is evaluated:
This uses automatic methods to compute exclusions:
Indicate that no exclusions should be computed:
Give exclusions as an equation:
Give multiple exclusion sets:
Use a condition with the exclusion equation:
Use both automatically computed and explicit exclusions:
Use a red line to indicate the exclusion set:
Omit excluded points:
Draw no frame:
Draw frames on the bottom and the left edges only:
Use the independent variables as frame labels:
Refine the surface where it changes quickly:
Show the initial and final sampling meshes:
Use 5 mesh levels in each direction:
Use mesh lines in the and directions:
Use mesh levels corresponding to fixed distances from the origin:
Use red mesh lines:
Use red mesh lines in the direction and thick mesh lines in the direction:
Generate a higher-quality plot:
Emphasize performance, possibly at the cost of quality:
Use more initial points to get smoother contours:
Automatically compute the range:
Use all points to compute the range:
Show the surface over the full , range:
Automatically compute the , range:
Use an explicit range to emphasize features:
Plot over an annulus region in and :
Regions do not have to be connected:
Use any logical combination of conditions:
Limit an elliptic curve to the unit disk:
Evaluate functions using machine-precision arithmetic:
Evaluate functions using arbitrary-precision arithmetic:
Simple shapes, including a line:
Plot an elliptic curve:
Plot a sum of five sine waves in random directions:
Find the minimum of a function in a region:
Show the steps taken to the minimum:
Have contours at the 10% and 90% percentile values:
An electrostatic potential built from a collection of point charges at positions :
Charge colors, green for negative and orange for positive:
Two charges and :
Three charges and :
ContourPlot samples more points where it needs to:
Use ListContourPlot for plotting data:
Use Plot3D and DensityPlot for surfaces and densities:
Use Plot for univariate functions:
Use ParametricPlot for plane parametric curves and regions:
Use ContourPlot3D and RegionPlot3D for implicit surfaces and regions:
Use Exclusions to avoid jumps that are detected as zero crossings:
A polynomial with zeros at the lattice points :
Random contour plots:
The inverse trigonometric functions:
New in 1 | Last modified in 7