This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
 Mathematica Tutorial Functions »|Tutorials »

# 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 y1, y2, ... at x values 1, 2, ... ListPlot[{{x1,y1},{x2,y2},...}] plot points (x1, y1), ... ListLinePlot[list] join the points with lines ListPlot3D[{{z11,z12,...},{z21,z22,...},...}] make a three-dimensional plot of the array of heights zyx ListPlot3D[{{x1,y1,z1},{x2,y2,z2},...}] make a three-dimensional plot with heights zi at positions {xi, yi} 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 data sets, Mathematica chooses a different color for each data set automatically.
 Out[4]=
This gives a list of x, y 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]=