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

Examples

open allclose all

Basic Examples  (5)

Plot a function:

Plot several functions with a legend:

Label each curve:

Fill below a curve:

Fill between two curves:

Plot multiple filled curves, automatically using transparent colors:

Scope  (27)

Sampling  (9)

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:

Use a scaled position:

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  (10)

Multiple curves are automatically colored to be distinct:

Provide explicit styling to different curves:

Include a legend:

Add labels for the axes and overall plot:

Add labels for the curves:

Label positions along a curve:

Provide an interactive Tooltip for each curve:

Create filled plots:

Use a plot theme:

Create an overlay mesh:

Style the curve segments between mesh points:

Options  (110)

AspectRatio  (1)

Choose the ratio of height to width from the actual plot values:

Axes  (2)

Draw no axes:

Draw the axis but no axis:

AxesLabel  (2)

Use labels based on variables specified in Plot:

Specify a label for each axis:

AxesOrigin  (2)

Determine where the axes cross automatically:

Specify the axes origin at the point :

AxesStyle  (1)

Specify the style of each axis:

BaselinePosition  (1)

Align graphs by the axis in each plot:

ClippingStyle  (5)

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:

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)

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:

Epilog  (2)

This inserts the graphics object in the resulting graphic:

Insert special markers to indicate whether a point belongs to the curve or not:

EvaluationMonitor  (3)

Find the list of values sampled by Plot:

Show where Plot evaluates Sin[x]:

Count how many times the function is evaluated:

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:

This gives two sets of exclusions:

Exclude an equation and the automatically chosen points:

ExclusionsStyle  (2)

Use dashed lines to indicate the vertical asymptotes:

Use black points to highlight the exclusions:

Filling  (7)

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:

FillingStyle  (4)

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:

LabelingSize  (4)

Textual labels are shown at their actual sizes:

Image labels are automatically resized:

Specify a maximum size for textual labels:

Specify a maximum size for image labels:

Show image labels at their natural sizes:

MaxRecursion  (2)

The default sampling mesh:

Each level of MaxRecursion will subdivide the initial mesh into a finer mesh:

Mesh  (3)

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:

MeshFunctions  (2)

Use a mesh evenly spaced in the and directions:

Show 5 mesh levels in the direction (red) and 10 in the direction (blue):

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)

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:

PerformanceGoal  (2)

Generate a higher-quality plot:

Emphasize performance, possibly at the cost of quality:

PlotLabel  (1)

Add an overall label to the plot:

PlotLabels  (5)

Specify text to label curves:

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:

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:

Place legends inside:

Use LineLegend to modify the appearance of the legend:

PlotPoints  (1)

Use more initial points to get a smoother curve:

PlotRange  (3)

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:

PlotRangeClipping  (2)

Constrain the curve to the framed region:

Draw the curve using the whole graphical region:

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:

MeshStyle by default uses the same style as PlotStyle:

PlotTheme  (2)

Use a theme with simple ticks and grid lines in a bright color scheme:

Change the color scheme:

RegionFunction  (2)

Show the curve where :

Exclude the region where :

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:

WorkingPrecision  (2)

Evaluate functions using machine-precision arithmetic:

Evaluate functions using arbitrary-precision arithmetic:

Applications  (19)

Basic Applications  (3)

Compare several functions:

A function and its inverse are reflections in :

Illustrate that -Abs[x]x Sin[1/x]Abs[x] in the interval:

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:

Local extrema are given by :

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:

Highlight the parts where a function is convex or concave:

A function is convex when :

A function is concave when :

Show them together with 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)

The epigraph of a function is given by . You can visualize the epigraph by using Filling:

The hypograph of a function is given by . You can visualize the hypograph by using Filling:

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:

Equation Solutions  (2)

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:

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:

Neat Examples  (1)

Eigenfunctions in a potential well:

Introduced in 1988
 (1.0)
 |
Updated in 2007
 (6.0)
2012
 (9.0)
2014
 (10.0)
2016
 (10.4)
2016
 (11.0)
2018
 (11.3)