Plot

Plot[f,{x,xmin,xmax}]
generates a plot of f as a function of x from xmin to xmax.
Plot[{f1,f2,…},{x,xmin,xmax}]
plots several functions fi.
Plot[{…,w[fi],…},…]
plots fi with features defined by the symbolic wrapper w.
Plot[…,{x}∈reg]
takes the variable x to be in the geometric region reg.
Details and Options




- Plot is known as a function plot or graph of a function.
- Plot evaluates f at values of x in the domain being plotted over and connects the points {x,f[x]} to form a curve showing how f varies with x. It visualizes the curve
.
- Gaps are left at any x where the fi evaluate to anything other than real numbers or Quantity.
- The limits xmin and xmax can be real numbers or Quantity expressions.
- The region reg can be any RegionQ object in 1D.
- 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.
- The following wrappers w can be used for the fi:
-
Annotation[fi,label] provide an annotation for the fi Button[fi,action] evaluate action when the curve for fi is clicked Callout[fi,label] label the function with a callout Callout[fi,label,pos] place the callout at relative position pos EventHandler[fi,events] define a general event handler for fi Hyperlink[fi,uri] make the function a hyperlink Labeled[fi,label] label the function Labeled[fi,label,pos] place the label at relative position pos Legended[fi,label] identify the function in a legend PopupWindow[fi,cont] attach a popup window to the function StatusArea[fi,label] display in the status area on mouseover Style[fi,styles] show the function using the specified styles Tooltip[fi,label] attach a tooltip to the function Tooltip[fi] use functions as tooltips - Wrappers w can be applied at multiple levels:
-
w[fi] wrap the fi w[{f1,…}] wrap a collection of fi w1[w2[…]] use nested wrappers - Callout, Labeled, and Placed can use the following positions pos:
-
Above position above curve Below position below curve Before position before curve After position after curve Start position at start of each curve End position at end of each curve x near the curve at a position x Scaled[s] scaled position s along the curve {s,Above} above relative position at position s along the curve {s,Below} below relative position at position s along the curve {pos,epos} epos in label placed at relative position pos of the curve - Plot has the same options as Graphics, with the following additions and changes:
-
AspectRatio 1/GoldenRatio ratio of height to width Axes True whether to draw axes ClippingStyle None what to draw where curves are clipped » ColorFunction Automatic how to determine the coloring of curves ColorFunctionScaling True whether to scale arguments to ColorFunction EvaluationMonitor None expression to evaluate at every function evaluation Exclusions Automatic points in x to exclude ExclusionsStyle None what to draw at excluded points Filling None filling to insert under each curve FillingStyle Automatic style to use for filling LabelingSize Automatic maximum size of callouts and labels MaxRecursion Automatic the maximum number of recursive subdivisions allowed Mesh None how many mesh points to draw on each curve MeshFunctions {#1&} how to determine the placement of mesh points MeshShading None how to shade regions between mesh points MeshStyle Automatic the style for mesh points Method Automatic the method to use for refining curves PerformanceGoal $PerformanceGoal aspects of performance to try to optimize PlotLabel None overall label for the plot PlotLabels None labels to use for curves PlotLayout Automatic how to position curves PlotLegends None legends for curves PlotPoints Automatic initial number of sample points PlotRange {Full,Automatic} the range of y or other values to include PlotRangeClipping True whether to clip at the plot range PlotStyle Automatic graphics directives to specify the style for each curve PlotTheme $PlotTheme overall theme for the plot RegionFunction (True&) how to determine whether a point should be included ScalingFunctions None how to scale individual coordinates TargetUnits Automatic units to display in the plot WorkingPrecision MachinePrecision the precision used in internal computations - Possible settings for ClippingStyle are:
-
Automatic use a dotted line for the clipped portion None omit the clipped portion of the curve style use style for the clipped portion - Possible settings for PlotLayout that show single curves in multiple plot panels include:
-
"Column" use separate curves in a column of panels "Row" use separate curves in a row of panels {"Column",k},{"Row",k} use k columns or rows {"Column",UpTo[k]},{"Row",UpTo[k]} use at most k columns or rows - With the default settings Exclusions->Automatic and ExclusionsStyle->None, Plot breaks curves at discontinuities and singularities it detects. Exclusions->None joins across discontinuities and singularities.
- Exclusions->{x1,x2,…} is equivalent to Exclusions->{x==x1,x==x2,…}.
- PlotLegends->"Expressions" uses the fi as the legend text.
- 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.
- Since only a finite number of sample points are used, it is possible for Plot to miss features of f. Increasing the settings for PlotPoints and MaxRecursion will often catch such features.
- Themes that affect curves include:
-
"ThinLines" thin plot lines "MediumLines" medium plot lines "ThickLines" thick plot lines - The arguments supplied to functions in MeshFunctions and RegionFunction are x, y. Functions in ColorFunction are by default supplied with scaled versions of these arguments.
- Possible settings for ScalingFunctions include:
-
sy scale the y axis {sx,sy} scale x and y axes - Each scaling function si is either a string "scale" or {g,g-1}, where g-1 is the inverse of g.



Examples
open allclose allBasic Examples (5)
Scope (30)
Sampling (10)
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 Exclusions->None to draw a connected curve:
Use PlotPoints and MaxRecursion to control adaptive sampling:
Use PlotRange to focus in on areas of interest:
The domain can be specified by a region:
Specify a domain using a MeshRegion:
Use ScalingFunctions to scale the axes:
Labeling and Legending (8)
Label curves with Labeled:
Place the labels relative to the curves:
Label curves with PlotLabels:
Place the label near the curve at an value:
Specify the text position relative to the point:
Label curves automatically with Callout:
Place a label with specific locations:
Include legends for each curve:
Use Legended to provide a legend for a specific curve:
Use Placed to change the legend location:
Presentation (12)
Multiple curves are automatically colored to be distinct:
Provide explicit styling to different curves:
Add labels for the axes and overall plot:
Label positions along a curve:
Provide an interactive Tooltip for each curve:
Style the curve segments between mesh points:
Plot over an infinite domain with automatic ticks:
Show multiple curves in a row of separate panels:
Options (113)
AxesLabel (2)
AxesStyle (3)
ClippingStyle (5)
ColorFunction (5)
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:
ColorFunctionScaling (3)
Epilog (2)
EvaluationMonitor (3)
Exclusions (7)
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:
ExclusionsStyle (2)
Filling (7)
FillingStyle (4)
Fill with red below the axis and blue above:
Use a variable filling style obtained from a ColorFunction:
LabelingSize (3)
MaxRecursion (2)
Each level of MaxRecursion will subdivide the initial mesh into a finer mesh:
Mesh (3)
MeshFunctions (2)
MeshShading (6)
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:
MeshStyle (4)
PerformanceGoal (2)
PlotLabels (5)
Place the labels above the curves:
Place the labels differently for each curve:
PlotLabels->"Expressions" uses functions as curve labels:
Use callouts to identify the curves:
Use None to not add a label:
PlotLayout (2)
PlotLegends (7)
No legends are used by default:
Create a legend based on the functions:
Create a legend with placeholder text:
Create a legend with specific labels:
PlotLegends picks up PlotStyle values automatically:
Use Placed to position legends:
Use LineLegend to modify the appearance of the legend:
PlotRange (3)
PlotRangeClipping (2)
PlotStyle (6)
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:
PlotTheme (2)
ScalingFunctions (9)
By default, plots have linear scales in each direction:
Use a log scale in the direction:
Use a linear scale in the direction that shows smaller numbers at the top:
Use a reciprocal scale in the direction:
Use different scales in the and
directions:
Reverse the axis without changing the
axis:
Use a scale defined by a function and its inverse:
Positions in Ticks and GridLines are automatically scaled:
PlotRange and AxesOrigin are automatically scaled:
Applications (19)
Basic Applications (3)
Highlighting Discrete Function Features (8)
Curves are broken where a function has singularities:
Emphasize the singularities by specifying ExclusionsStyle:
Highlight the discontinuities in a function using ExclusionsStyle:
The discontinuities are automatically derived but can also be specified:
Highlight zeros of a function :
The second argument passed to MeshFunctions is :
Highlight local extrema for a function using MeshFunctions:
Highlight the local maximums and minimums of a function :
The local maximums are the points where and
:
Similarly the local minimums are given by and
:
Highlight the non-negative and non-positive parts of a function :
Using the Filling specification allows this to be readily achieved:
Highlight the segments where the function is increasing or decreasing:
A function is increasing when :
A function is decreasing when :
Show them together and add a legend:
Highlighting Continuous Function Features (1)
Use color to overlay the derivative of function on top of the curve for
:
By rescaling the derivative to be between 0 and 1, you can easily map to a color:
From ColorData you can get a variety of color scales:
The derivative can now be overlaid as color on top of the curve using ColorFunction:
Using Filling emphasizes the color more:
Epigraph and Hypograph of a Function (2)
Complex-Valued Functions (3)
Plot the real and imaginary parts of a complex-valued function of a real variable:
Plot the magnitude and phase of a complex-valued function of a real variable:
Plot the magnitude and color based on the phase of the function:
Add filling and a color legend that provides a separate axis for the phase:
Properties & Relations (9)
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:
AbsArgPlot is a special case of Plot:
ReImPlot is a special case of Plot:
Use Plot3D and ParametricPlot3D for function and parametric surfaces:
Text
Wolfram Research (1988), Plot, Wolfram Language function, https://reference.wolfram.com/language/ref/Plot.html (updated 2021).
CMS
Wolfram Language. 1988. "Plot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/Plot.html.
APA
Wolfram Language. (1988). Plot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Plot.html