Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Visualization and Graphics > Data Visualization >

ListPlot

ListPlot[{y1, y2, ...}]
plots points corresponding to a list of values, assumed to correspond to x coordinates 1, 2, ....
ListPlot[{{x1, y1}, {x2, y2}, ...}]
plots a list of points with specified x and y coordinates.
ListPlot[{list1, list2, ...}]
plots several lists of points.
  • ListPlot has the same options as Graphics, with the following additions and changes:
AspectRatio1/GoldenRatioratio of height to width
AxesTruewhether to draw axes
DataRangeAutomaticthe range of x values to assume for data
FillingNonehow to fill in stems for each point
FillingStyleAutomaticstyle to use for filling
JoinedFalsewhether to join points
PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
PlotMarkersNonemarkers to use to indicate each point
PlotRangeAutomaticrange of values to include
PlotRangeClippingTruewhether to clip at the plot range
PlotStyleAutomaticgraphics directives to determine styles of points
  • ListPlot[{list1, list2, ...}] by default uses different colors to indicate points from different listi.
  • Tooltip[yi] or Tooltip[{xi, yi}] indicates that the coordinates of a point should be displayed in its tooltip.
  • Tooltip[list] specifies that coordinate tooltips should be displayed for all points in the list.
  • Tooltip[list, label] gives the specified tooltip label for all points in list.
  • ListPlot[{list1, list2, ...}, Joined->{s1, s2, ...}] gives specifications si for whether to join the points in each of the listi.
  • ListPlot[{list1, list2, ...}] by default takes the x coordinates for successive points in each of the listi to be successive integers starting at 1.
  • The setting DataRange->{xmin, xmax} specifies other ranges of x coordinates to use, with xmax being associated with the last element in the longest of the listi.
  • With the default setting DataRange->Automatic, ListPlot[{{a11, a12}, ..., {an1, an2}}] will be taken to give x and y values for n separate points, rather than y values for n separate datasets each containing two points.
  • With the setting PlotStyle->{style1, style2, ...} the stylei are used cyclically to determine the styles of points in each of the listi.
Plot a list of y values:
Plot a list of x,y pairs:
Plot several datasets:
Plot a list of y values:
In[1]:=
Click for copyable input
Out[1]=
 
Plot a list of x,y pairs:
In[1]:=
Click for copyable input
Out[1]=
 
Plot several datasets:
In[1]:=
Click for copyable input
Out[1]=
For regular data consisting of y values, the x data range is taken to be integer values:
Provide an explicit x data range by using DataRange:
Plot multiple sets of regular data:
For irregular data consisting of {x,y} value pairs the x data range is inferred from data:
Plot multiple sets of irregular data:
Plot multiple sets of data, regular or irregular, using DataRange to map them to the same x range:
Ranges where the data is nonreal are excluded:
Use MaxPlotPoints to limit the number of points used:
PlotRange is selected automatically:
Use PlotRange to focus on areas of interest:
Multiple datasets are automatically colored to be distinct:
Provide explicit styling to different sets:
Add labels:
Provide an interactive Tooltip for the data:
Create filled plots:
Use shapes to distinguish different datasets:
Use labels to distinguish different datasets:
Use Joined to connect datasets with lines:
Use InterpolationOrder to smooth joined data:
Use SparseArray to plot values represented by rules:
Choose the ratio of height to width from the actual plot values:
Set the ratio to 1:
Specify labels for the x and y axes:
The locations of the axes are determined automatically:
Specify where the axes cross:
ClippingStyle requires at least one dataset to be Joined:
Omit clipped regions of the plot:
Show 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 requires at least one dataset to be Joined:
Color by scaled x and y coordinates:
Color with a named color scheme:
Fill with the color used for the curve:
ColorFunction has higher priority than PlotStyle for coloring the curve:
ColorFunctionScaling requires at least one dataset to be Joined:
Color the line based on the scaled y value:
Color the line based on the unscaled y value:
Lists of height values are displayed against the number of elements:
Rescale to the sampling space:
Each dataset is scaled to the same domain:
Pairs are interpreted as x,y coordinates:
Specifying DataRange in this case has no effect, since x values are part of the data:
Force interpretation as multiple datasets:
Use symbolic or explicit values for "stem" filling:
Fill between corresponding points in two datasets:
Fill between datasets using a particular style:
Fill between datasets 1 and 2; use red when 1 is less than 2 and blue otherwise:
Fill to the axis for irregularly sampled data:
Use several irregular datasets; filling between them will use the first as the reference:
Joined datasets fill with solid areas:
The type of filling depends on whether the first set is joined:
Fill with blue "stems":
Fill with dashed magenta "stems":
Fill with red below the axis, and blue above:
Filling for Joined cases is solid:
Joined lines can be interpolated:
By default linear interpolation is used:
Use zero-order or piecewise-constant interpolation:
Use third-order spline interpolation:
Interpolation order zero to 5:
Join the dataset with a line:
Join the first dataset with a line, but use points for the second dataset:
Join the dataset with a line, and show the original points:
The type of filling depends on whether the set is joined:
All points are included by default:
Uniformly spaced data is downsampled:
In this case downsampling from 10^6 to 10^3 points:
Nonuniform data is topologically subsampled, to preserve features:
Mesh requires at least one dataset to be Joined:
The initial and final sampling meshes are typically the same:
Interpolated data may introduce points:
Use 20 mesh levels evenly spaced in the x direction:
Use an explicit list of values for the mesh in the x direction:
Use explicit styles at specific points:
MeshFunctions requires at least one dataset to be Joined:
Use a mesh evenly spaced in the x and y directions:
Show five mesh levels in the x direction (red) and ten in the y direction (blue):
MeshShading requires at least one dataset to be Joined:
Alternate red and blue segments of equal width in the x 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 requires at least one dataset to be Joined:
Color the mesh the same color as the plot:
Use a red mesh in the x direction:
Use a red mesh in the x direction and a blue mesh in the y direction:
Use big red mesh points in the x direction:
ListPlot normally uses distinct colors to distinguish different sets of data:
Automatically use colors and shapes to distinguish sets of data:
Use shapes only:
Change the size of the default plot markers:
Use arbitrary text for plot markers:
Use explicit graphics for plot markers:
Use the same symbol for all the sets of data:
Explicitly use a symbol and size:
PlotRange is automatically calculated:
Show the whole dataset:
Use different style directives:
By default different styles are chosen for multiple datasets:
Explicitly specify the style for different datasets:
PlotStyle applies to both lines and points:
PlotStyle can be combined with ColorFunction:
PlotStyle can be combined with MeshShading:
MeshStyle by default uses the same style as PlotStyle:
Compare the n^(th) prime to an estimate:
Show the evaluation points in order used by a numerical function:
Show both evaluation points and value used by a numerical function:
Plot life expectancy against birth rates for all the countries:
Show the linear relationship between enthalpy of vaporization and boiling point:
Plot a discrete-time signal and its spectrum:
Plot the probability mass function for a distribution:
Plot the empirical probability mass function:
Plot a solution sequence to a difference equation:
Plot randomly sampled properties:
ListLinePlot is a special case of ListPlot:
Use Plot for functions:
Use ListLogPlot, ListLogLogPlot and ListLogLinearPlot for logarithmic plots:
Use ListPolarPlot for polar plots:
Use DateListPlot to show data over time:
Use ListPointPlot3D to show three-dimensional points:
Use ListPlot3D to create surfaces from data:
Use ListContourPlot to create contours from continuous data:
Use ListDensityPlot to create densities from continuous data:
Use ArrayPlot and MatrixPlot for arrays of discrete values:
Use ParametricPlot for parametric curves:
New in 1 | Last modified in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team