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

Plot

Plot
generates a plot of f as a function of x from to .
Plot
plots several functions .
  • Plot treats the variable x as local, effectively using Block.
  • Plot has attribute HoldAll, and evaluates f only after assigning specific numerical values to x.
  • In some cases it may be more efficient to use Evaluate to evaluate f symbolically before specific numerical values are assigned to x.
  • No curve is drawn in any regions where f evaluates to None.
  • Plot has the same options as Graphics, with the following additions and changes:
AspectRatio1/GoldenRatioratio of width to height
AxesTruewhether to draw axes
ClippingStyleNonewhat to draw where curves are clipped  »
ColorFunctionAutomatichow to determine the coloring of curves
ColorFunctionScalingTruewhether to scale arguments to ColorFunction
EvaluationMonitorNoneexpression to evaluate at every function evaluation
ExclusionsAutomaticpoints in x to exclude
ExclusionsStyleNonewhat to draw at excluded points
FillingNonefilling to insert under each curve
FillingStyleAutomaticstyle to use for filling
MaxRecursionAutomaticthe maximum number of recursive subdivisions allowed
MeshNonehow many mesh points to draw on each curve
MeshFunctions{#1&}how to determine the placement of mesh points
MeshShadingNonehow to shade regions between mesh points
MeshStyleAutomaticthe style for mesh points
MethodAutomaticthe method to use for refining curves
PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
PlotPointsAutomaticinitial number of sample points
PlotRange{Full,Automatic}the range of y or other values to include
PlotRangeClippingTruewhether to clip at the plot range
PlotStyleAutomaticgraphics directives to specify the style for each curve
RegionFunction(True&)how to determine whether a point should be included
WorkingPrecisionMachinePrecisionthe precision used in internal computations
  • Plot[Tooltip[{f1, f2, ...}], {x, xmin, xmax}] specifies that the should be displayed as tooltip labels for the corresponding curves.
  • Tooltip specifies an explicit tooltip label for a curve.
  • Plot initially evaluates f at a number of equally spaced sample points specified by PlotPoints. Then it uses an adaptive algorithm to choose additional sample points, subdividing a given interval at most MaxRecursion times.
  • You should realize that with the finite number of sample points used, it is possible for Plot to miss features in your function. To check your results, you should try increasing the settings for PlotPoints and MaxRecursion.
  • On makes Plot print a message if it is unable to reach a certain smoothness of curve.
  • With Mesh->All, Plot will explicitly draw a point at every position on each curve where each function was sampled.
  • The functions are evaluated all along each curve.
  • With ClippingStyle->Automatic a line is drawn at the top or bottom of the plotting area wherever a curve goes outside the range of the plot.
Plot a function:
Plot several functions:
Fill below a curve:
Fill between two curves:
Plot multiple filled curves, automatically using transparent colors:
Plot a function:
In[1]:=
Click for copyable input
Out[1]=
 
Plot several functions:
In[1]:=
Click for copyable input
Out[1]=
 
Fill below a curve:
In[1]:=
Click for copyable input
Out[1]=
Fill between two curves:
In[2]:=
Click for copyable input
Out[2]=
 
Plot multiple filled curves, automatically using transparent colors:
In[1]:=
Click for copyable input
Out[1]=
More points are sampled when the function changes quickly:
The plot range is selected automatically:
Ranges where the function becomes nonreal are excluded:
The curve 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 points or split the resulting curve:
Multiple curves are automatically colored to be distinct:
Provide explicit styling to different curves:
Add labels:
Provide an interactive Tooltip for each curve:
Create filled plots:
Create an overlay mesh:
Style the curve segments between mesh points:
Link curves to external information:
Choose the ratio of height to width from the actual plot values:
Draw no axes:
Draw the axis but no axis:
Use labels based on variables specified in Plot:
Specify a label for each axis:
Determine where the axes cross automatically:
Specify the axes origin at the point :
Specify the style of each axis:
Align graphs by the axis in each plot:
Omit clipped regions of the plot:
Show the clipped regions like the rest of the curve:
Show clipped regions with red lines:
Show clipped regions as red at the bottom and thick at the top:
Show clipped regions as red and thick:
Color by a scaled coordinate and scaled coordinate, respectively:
Color with a named color scheme:
Color a curve red when its absolute coordinate is above 0:
Fill with the color used for the curve:
ColorFunction has higher priority than PlotStyle for coloring the curve:
No argument scaling on the left; automatic scaling on the right:
Color a curve red when its absolute coordinate is above 0:
Use hue to indicate direction and brightness to indicate amplitude:
This inserts the graphics object in the resulting graphic:
Insert special markers to indicate whether a point belongs to the curve or not:
Find the list of values sampled by Plot:
Show where Plot evaluates Sin[x]:
Count how many times the function is evaluated:
Use automatic methods for computing exclusions, in this case for a piecewise function:
In this case the exclusion comes from a branch cut discontinuity:
Indicate that no exclusions should be computed:
Exclude a fixed set of points:
Give a set of exclusions as an equation:
This gives two sets of exclusions:
Exclude an equation and the automatically chosen points:
Use dashed lines to indicate the vertical asymptotes:
Use black points to highlight the exclusions:
Use symbolic or explicit values:
By default, overlapping fills combine using opacity:
Fill between curve 1 and the axis:
Fill between curves 1 and 2:
Fill between curves 1 and 2 with a specific style:
Fill between curves 1 and with yellow:
Fill between curves 1 and 2; use yellow when 1 is below 2, and green when 1 is above 2:
Use different fill colors:
Fill with opacity 0.5 orange:
Fill with red below the axis and blue above:
Use a variable filling style obtained from a ColorFunction:
The default sampling mesh:
Each level of MaxRecursion will subdivide the initial mesh into a finer mesh:
Show the initial and final sampling meshes:
Use 20 mesh levels evenly spaced in the direction:
Use an explicit list of values for the mesh in the direction:
Use a mesh evenly spaced in the and directions:
Show 5 mesh levels in the direction (red) and 10 in the direction (blue):
Alternate red and blue segments of equal width in the direction:
Use None to remove segments:
MeshShading can be used with PlotStyle:
MeshShading has higher priority than PlotStyle for styling the curve:
Use PlotStyle for some segments by setting MeshShading to Automatic:
MeshShading can be used with ColorFunction:
Color the mesh the same color as the plot:
Use a red mesh in the direction:
Use a red mesh in the direction and a blue mesh in the direction:
Use big red mesh points in the direction:
Generate a higher-quality plot:
Emphasize performance, possibly at the cost of quality:
Use more initial points to get a smoother curve:
Show the curve over the whole domain:
Show the curve only where it is real valued:
Show the curve from to over the whole domain:
Constrain the curve to the framed region:
Draw the curve using the whole graphical region:
Use different style directives:
By default different styles are chosen for multiple curves:
Explicitly specify the style for different curves:
PlotStyle can be combined with ColorFunction:
PlotStyle can be combined with MeshShading:
MeshStyle by default uses the same style as PlotStyle:
Show the curve where :
Exclude the region where :
Evaluate functions using machine-precision arithmetic:
Evaluate functions using arbitrary-precision arithmetic:
A function and its inverse are reflections in :
Illustrate that -Abs[x]≤x Sin[1/x]≤Abs[x] in the interval:
The general solution to a differential equation:
Plot two particular solutions:
Plot a family of solutions:
The general solution to an algebraic equation:
Plot a family of solutions:
Visualize the trigonometric functions with singularities:
Color a curve by complex phase:
Plot as a function of parameter the output from 100 iterations of the logistic map:
Plot samples more points where it needs to:
Plot is a special case of ParametricPlot for curves:
Use ParametricPlot for parametric curves and regions:
Use ContourPlot and RegionPlot for implicit curves and regions:
Use LogPlot, LogLinearPlot, and LogLogPlot for logarithmic plots:
Use ListPlot and ListLinePlot for data:
Use Plot3D and ParametricPlot3D for function and parametric surfaces:
Eigenfunctions in a potential well:
New in 1 | Last modified in 6