This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 MATHEMATICA TUTORIAL Related Tutorials »| Functions »

# Plotting Lists of Data

Mathematica can be used to make plots of functions. You give Mathematica a function, and it builds up a curve or surface by evaluating the function at many different points.
Here we describe how you can make plots from lists of data, instead of functions. ("Importing and Exporting Data" discusses how to read data from external files and programs.) The Mathematica commands for plotting lists of data are direct analogs of the ones for plotting functions.
 ListPlot[{y1,y2,...}] plot at x values ListPlot[{{x1,y1},{x2,y2},...}] plot points ListLinePlot[list] join the points with lines ListPlot3D[{{z11,z12,...},{z21,z22,...},...}] make a three-dimensional plot of the array of heights ListPlot3D[{{x1,y1,z1},{x2,y2,z2},...}] make a three-dimensional plot with heights at positions ListContourPlot[array] make a contour plot ListDensityPlot[array] make a density plot

Functions for plotting lists of data.

Here is a list of values.
 Out[1]=
This plots the values.
 Out[2]=
This joins the points with lines.
 Out[3]=
When plotting multiple datasets, Mathematica chooses a different color for each dataset automatically.
 Out[4]=
This gives a list of pairs.
 Out[5]=
This plots the points.
 Out[6]=
This gives a rectangular array of values. The array is quite large, so we end the input with a semicolon to stop the result from being printed out.
This makes a three-dimensional plot of the array of values.
 Out[8]=
This gives a density plot of the array of values.
 Out[9]=