Mathematica

Plotting data

Plotting a list of points

Data can be in the form of a simple list of numbers;

	points = {3,2,4,1,8,3,2,4,2,7,3,2,4};
	ListPlot[points, PlotJoined->True];

...or as pairs of values --- x-y coordinates;


	points = { {5,3}, {2,5.5}, {-1,3}, {4,2}, {4,3.5} };
	ListPlot[points, PlotStyle->{PointSize[0.03],Hue[0.7]}];
(The PlotStyle option is not necessary; in this case it is used to make the points blue and larger than usual.)

Use ReadList to read data from a file.


Viewing a rectangular array of points

One can read data in from a separate text file using ``ReadList''. A 25x30 array of values would be read from file matrix.dat with the command
data = ReadList["matrix.dat", Table[Real,{30}]]

To illustrate three graphing commands for arrays of data, we will instead construct our own array of data, using ``Table'';


	data = Table[(i-j)^2+300Sin[(i+j)/9], {i,30}, {j,25} ];
	ListPlot3D[data];


	ListDensityPlot[data];


	ListContourPlot[data];


Next: Linear Algebra
Index