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 evaluates f at different values of x to create a smooth curve of the form {x,f[x]}.
• 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:
•  Automatic automatically placed labels Above, Below, Before, After positions around the curve x near the curve at a position x Scaled[s] scaled position s along the curve {s,Above},{s,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 PlotLabel None overall label for the plot PlotLabels None labels to use for curves 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 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
• With the default settings and , Plot breaks curves at discontinuities and singularities it detects. 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.
• ScalingFunctions->"scale" scales the coordinate; ScalingFunctions{"scalex","scaley"} scales both the and coordinates.

Examples

open all close all

Basic Examples(5)

Plot a function:

 In[1]:=
 Out[1]=

Plot several functions with a legend:

 In[1]:=
 Out[1]=

Label each curve:

 In[1]:=
 Out[1]=

Fill below a curve:

 In[1]:=
 Out[1]=

Fill between two curves:

 In[2]:=
 Out[2]=

Plot multiple filled curves, automatically using transparent colors:

 In[1]:=
 Out[1]=

Neat Examples(1)

Introduced in 1988
(1.0)
|
Updated in 2018
(11.3)