matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. matplotlib can be used in python scripts, the python and ipython shell (ala matlab or mathematica), web application servers, and six graphical user interface toolkits.
matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. For a sampling, see the screenshots, thumbnail gallery, and examples directory
Please see the matplotlib web page for more information: matplotlib.
Load the matplotlib modulefile and then the matplotlib objects will be available in python. Please see the matplotlib User Guide for more information.
Note that the default matplotlib behavior is to defer drawing a plot until the end of a script. If you want to change this behavior, then create your own .matplotlibrc file with "interactive" set to True.
The interactive property of the pyplot interface controls whether a figure canvas is drawn on every pyplot command. If interactive is False (default setting), then the figure state is updated on every plot command, but will only be drawn on explicit calls to draw(). When interactive is True, then every pyplot command triggers a draw. The pyplot interface provides four commands that are useful for interactive control:
isinteractive() - returns the interactive setting True|False ion() - turns interactive mode on ioff() - turns interactive mode off draw() - forces a figure redraw
Example 1: To generate simple plot, do the following:
python >>> from pylab import * >>> ion() >>> plot([1,2,3])
Example 2: To generate 10,000 Gaussian random numbers and make a histogram plot binning the data into 100 bins, you simply need to type
python >>> from pylab import randn, hist >>> x = randn(10000) >>> hist(x,100)
This package has the following support level : Unsupported