933 lines (930 with data), 72.5 kB
@header@
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="matplotlib.html"><font color="#ffffff">matplotlib</font></a>.matlab</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/lib/python2.3/site-packages/matplotlib/matlab.py">/usr/local/lib/python2.3/site-packages/matplotlib/matlab.py</a></font></td></tr></table>
<p><tt>This is a matlab style functional interface the matplotlib.<br>
<br>
The following plotting commands are provided; some of these do not<br>
exist in matlab but have proven themselves to be useful nonetheless.<br>
The majority of them, however, are matlab commands<br>
<br>
_Plotting commands<br>
<br>
axes - Create a new axes<br>
axhline - draw a horizontal line across axes<br>
axvline - draw a vertical line across axes<br>
axhspan - draw a horizontal bar across axes<br>
axvspan - draw a vertical bar across axes <br>
axis - Set or return the current axis limits<br>
bar - make a bar chart<br>
barh - a horizontal bar chart <br>
cla - clear current axes<br>
clf - clear a figure window<br>
close - close a figure window<br>
colorbar - add a colorbar to the current figure<br>
cohere - make a plot of coherence<br>
csd - make a plot of cross spectral density <br>
draw - Force a redraw of the current figure<br>
errorbar - make an errorbar graph<br>
figlegend - make legend on the figure rather than the axes<br>
figimage - make a figure image<br>
figtext - add text in figure coords<br>
figure - create or change active figure<br>
fill - make filled polygons<br>
gca - return the current axes<br>
gcf - return the current figure<br>
gci - get the current image, or None<br>
get - get a handle graphics property<br>
gray - set the current colormap to gray<br>
jet - set the current colormap to jet<br>
hist - make a histogram<br>
hold - set the axes hold state<br>
legend - make an axes legend<br>
loglog - a log log plot<br>
imread - load image file into array<br>
imshow - plot image data<br>
pcolor - make a pseudocolor plot<br>
plot - make a line plot<br>
polar - make a polar plot on a PolarAxes<br>
psd - make a plot of power spectral density<br>
rc - control the default params<br>
savefig - save the current figure<br>
scatter - make a scatter plot<br>
set - set a handle graphics property<br>
semilogx - log x axis<br>
semilogy - log y axis<br>
show - show the figures<br>
specgram - a spectrogram plot<br>
stem - make a stem plot<br>
subplot - make a subplot (numrows, numcols, axesnum)<br>
table - add a table to the plot<br>
text - add some text at location x,y to the current axes<br>
title - add a title to the current axes<br>
xlim - set/get the xlimits<br>
ylim - set/get the ylimits<br>
xticks - set/get the xticks<br>
yticks - set/get the yticks<br>
xlabel - add an xlabel to the current axes<br>
ylabel - add a ylabel to the current axes<br>
<br>
_Matrix commands<br>
<br>
cumprod - the cumulative product along a dimension<br>
cumsum - the cumulative sum along a dimension<br>
detrend - remove the mean or besdt fit line from an array<br>
diag - the k-th diagonal of matrix <br>
diff - the n-th differnce of an array<br>
eig - the eigenvalues and eigen vectors of v<br>
eye - a matrix where the k-th diagonal is ones, else zero <br>
find - return the indices where a condition is nonzero <br>
fliplr - flip the rows of a matrix up/down<br>
flipud - flip the columns of a matrix left/right<br>
linspace - a linear spaced vector of N values from min to max inclusive<br>
meshgrid - repeat x and y to make regular matrices<br>
ones - an array of ones<br>
rand - an array from the uniform distribution [0,1]<br>
randn - an array from the normal distribution<br>
rot90 - rotate matrix k*90 degress counterclockwise<br>
squeeze - squeeze an array removing any dimensions of length 1<br>
tri - a triangular matrix<br>
tril - a lower triangular matrix<br>
triu - an upper triangular matrix<br>
vander - the Vandermonde matrix of vector x<br>
svd - singular value decomposition<br>
zeros - a matrix of zeros<br>
<br>
_Probability<br>
<br>
levypdf - The levy probability density function from the char. func.<br>
normpdf - The Gaussian probability density function<br>
rand - random numbers from the uniform distribution<br>
randn - random numbers from the normal distribution<br>
<br>
_Statistics<br>
<br>
corrcoef - correlation coefficient<br>
cov - covariance matrix<br>
max - the maximum along dimension m<br>
mean - the mean along dimension m<br>
median - the median along dimension m<br>
min - the minimum along dimension m<br>
norm - the norm of vector x<br>
prod - the product along dimension m<br>
ptp - the max-min along dimension m<br>
std - the standard deviation along dimension m<br>
sum - the sum along dimension m<br>
<br>
_Time series analysis<br>
<br>
bartlett - M-point Bartlett window<br>
blackman - M-point Blackman window<br>
cohere - the coherence using average periodiogram<br>
csd - the cross spectral density using average periodiogram<br>
fft - the fast Fourier transform of vector x<br>
hamming - M-point Hamming window<br>
hanning - M-point Hanning window<br>
hist - compute the histogram of x<br>
kaiser - M length Kaiser window<br>
psd - the power spectral density using average periodiogram<br>
sinc - the sinc function of array x<br>
<br>
_Dates<br>
<br>
date2num - convert python datetimes to numeric representation<br>
drange - create an array of numbers for date plots<br>
num2date - convert numeric type (float days since 0001) to datetime<br>
<br>
_Other<br>
<br>
angle - the angle of a complex array<br>
load - load ASCII data into array<br>
polyfit - fit x, y to an n-th order polynomial<br>
polyval - evaluate an n-th order polynomial<br>
roots - the roots of the polynomial coefficients in p<br>
save - save an array to an ASCII file<br>
trapz - trapezoidal integration<br>
<br>
__end<br>
<br>
Credits: The plotting commands were provided by<br>
John D. Hunter <jdhunter@ace.bsd.uhicago.edu><br>
<br>
Most of the other commands are from the Numeric, MLab and FFT, with<br>
the exception of those in mlab.py provided by matplotlib.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="LinearAlgebra.html">LinearAlgebra</a><br>
<a href="MLab.html">MLab</a><br>
<a href="Numeric.html">Numeric</a><br>
<a href="RandomArray.html">RandomArray</a><br>
<a href="matplotlib._matlab_helpers.html">matplotlib._matlab_helpers</a><br>
</td><td width="25%" valign=top><a href="matplotlib.cm.html">matplotlib.cm</a><br>
<a href="copy.html">copy</a><br>
<a href="copy_reg.html">copy_reg</a><br>
<a href="matplotlib.image.html">matplotlib.image</a><br>
<a href="math.html">math</a><br>
</td><td width="25%" valign=top><a href="matplotlib.html">matplotlib</a><br>
<a href="matplotlib.mlab.html">matplotlib.mlab</a><br>
<a href="multiarray.html">multiarray</a><br>
<a href="matplotlib.numerix.html">matplotlib.numerix</a><br>
<a href="operator.html">operator</a><br>
</td><td width="25%" valign=top><a href="os.html">os</a><br>
<a href="pickle.html">pickle</a><br>
<a href="string.html">string</a><br>
<a href="sys.html">sys</a><br>
<a href="types.html">types</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
<td width="100%"><dl><dt><a name="-arange"><strong>arange</strong></a>(...)</dt><dd><tt><a href="#-arange">arange</a>(start, stop=None, step=1, typecode=None)<br>
<br>
Just like range() except it returns an array whose type can be<br>
specified by the keyword argument typecode.</tt></dd></dl>
<dl><dt><a name="-array"><strong>array</strong></a>(...)</dt><dd><tt><a href="#-array">array</a>(sequence, typecode=None, copy=1, savespace=0) will return a new array formed from the given (potentially nested) sequence with type given by typecode. If no typecode is given, then the type will be determined as the minimum type required to hold the objects in sequence. If copy is zero and sequence is already an array, a reference will be returned. If savespace is nonzero, the new array will maintain its precision in operations.</tt></dd></dl>
<dl><dt><a name="-arrayrange"><strong>arrayrange</strong></a> = arange(...)</dt><dd><tt><a href="#-arange">arange</a>(start, stop=None, step=1, typecode=None)<br>
<br>
Just like range() except it returns an array whose type can be<br>
specified by the keyword argument typecode.</tt></dd></dl>
<dl><dt><a name="-axes"><strong>axes</strong></a>(*args, **kwargs)</dt><dd><tt>Add an axes at positon rect specified by::<br>
<br>
<a href="#-axes">axes</a>() by itself creates a default full <a href="#-subplot">subplot</a>(111) window axis<br>
<br>
<a href="#-axes">axes</a>(rect, axisbg='w') where rect=[left, bottom, width, height] in<br>
normalized (0,1) units. axisbg is the background color for the<br>
axis, default white<br>
<br>
<a href="#-axes">axes</a>(h) where h is an axes instance makes h the<br>
current axis An Axes instance is returned</tt></dd></dl>
<dl><dt><a name="-axis"><strong>axis</strong></a>(*v)</dt><dd><tt>Set/Get the axis properties::<br>
<br>
<a href="#-axis">axis</a>() returns the current axis as a length a length 4 vector<br>
<br>
<a href="#-axis">axis</a>(v) where v = [xmin, xmax, ymin, ymax] sets the min and max of the x<br>
and y axis limits<br>
<br>
<a href="#-axis">axis</a>('off') turns off the axis lines and labels<br>
<br>
<a href="#-axis">axis</a>('equal') sets the xlim width and ylim height to be to be<br>
identical. The longer of the two intervals is chosen</tt></dd></dl>
<dl><dt><a name="-changed_name_function"><strong>changed_name_function</strong></a>(f, newname)</dt></dl>
<dl><dt><a name="-choose"><strong>choose</strong></a>(...)</dt><dd><tt><a href="#-choose">choose</a>(a, (b1,b2,...))</tt></dd></dl>
<dl><dt><a name="-clf"><strong>clf</strong></a>()</dt><dd><tt>Clear the current figure</tt></dd></dl>
<dl><dt><a name="-clim"><strong>clim</strong></a>(vmin<font color="#909090">=None</font>, vmax<font color="#909090">=None</font>)</dt><dd><tt>Set the color limits of the current image<br>
<br>
To apply clim to all axes images do<br>
<br>
<a href="#-clim">clim</a>(0, 0.5)<br>
<br>
If either vmin or vmax is None, the image min/max respectively<br>
will be used for color scaling.<br>
<br>
If you want to set the clim of multiple images,<br>
use, for example for im in <a href="#-gca">gca</a>().get_images(): im.set_clim(0,<br>
0.05)</tt></dd></dl>
<dl><dt><a name="-close"><strong>close</strong></a>(*args)</dt><dd><tt>Close a figure window<br>
<br>
<a href="#-close">close</a>() by itself closes the current figure<br>
<br>
<a href="#-close">close</a>(num) closes figure number num<br>
<br>
<a href="#-close">close</a>(h) where h is a figure handle(instance) closes that figure<br>
<br>
<a href="#-close">close</a>('all') closes all the figure windows</tt></dd></dl>
<dl><dt><a name="-colorbar"><strong>colorbar</strong></a>(tickfmt<font color="#909090">='%1.1f'</font>)</dt><dd><tt>Create a colorbar for current mappable image (see gci)<br>
<br>
tickfmt is a format string to format the colorbar ticks<br>
<br>
return value is the colorbar axes instance</tt></dd></dl>
<dl><dt><a name="-colors"><strong>colors</strong></a>()</dt><dd><tt>This is a do nothing function to provide you with help on how<br>
matplotlib handles colors.<br>
<br>
Commands which take color arguments can use several formats to<br>
specify the colors. For the basic builtin colors, you can use a<br>
single letter<br>
<br>
b : blue<br>
g : green<br>
r : red<br>
c : cyan<br>
m : magenta<br>
y : yellow<br>
k : black <br>
w : white<br>
<br>
<br>
For a greater range of colors, you have two options. You can<br>
specify the color using an html hex string, as in<br>
<br>
color = '#eeefff'<br>
<br>
or you can pass an R,G,B tuple, where each of R,G,B are in the<br>
range [0,1]. The example below creates a subplot with a dark<br>
slate gray background<br>
<br>
<a href="#-subplot">subplot</a>(111, axisbg=(0.1843, 0.3098, 0.3098))<br>
<br>
Here is an example that creates a pale turqoise title<br>
<br>
<a href="#-title">title</a>('Is this the best color?', color='#afeeee')</tt></dd></dl>
<dl><dt><a name="-cross_correlate"><strong>cross_correlate</strong></a>(...)</dt><dd><tt><a href="#-cross_correlate">cross_correlate</a>(a,v, mode=0)</tt></dd></dl>
<dl><dt><a name="-draw"><strong>draw</strong></a>()</dt><dd><tt>redraw the current figure</tt></dd></dl>
<dl><dt><a name="-figimage"><strong>figimage</strong></a>(*args, **kwargs)</dt><dd><tt>FIGIMAGE(X) # add non-resampled array to figure<br>
<br>
FIGIMAGE(X, xo, yo) # with pixel offsets<br>
<br>
FIGIMAGE(X, **kwargs) # control interpolation ,scaling, etc<br>
<br>
Add a nonresampled figure to the figure from array X. xo and yo are<br>
offsets in pixels<br>
<br>
X must be a float array<br>
<br>
If X is MxN, assume luminance (grayscale)<br>
If X is MxNx3, assume RGB<br>
If X is MxNx4, assume RGBA<br>
<br>
The following kwargs are allowed: <br>
<br>
* cmap is a cm colormap instance, eg cm.jet. If None, default to<br>
the rc image.cmap valuex<br>
<br>
* norm is a matplotlib.colors.normalize instance; default is<br>
normalization(). This scales luminance -> 0-1<br>
<br>
* vmin and vmax are used to scale a luminance image to 0-1. If<br>
either is None, the min and max of the luminance values will be<br>
used. Note if you pass a norm instance, the settings for vmin and<br>
vmax will be ignored.<br>
<br>
* alpha = 1.0 : the alpha blending value<br>
<br>
* origin is either 'upper' or 'lower', which indicates where the [0,0]<br>
index of the array is in the upper left or lower left corner of<br>
the axes. Defaults to the rc image.origin value<br>
<br>
This complements the axes image which will be resampled to fit the<br>
current axes. If you want a resampled image to fill the entire<br>
figure, you can define an Axes with size [0,1,0,1].<br>
<br>
A image.FigureImage instance is returned.</tt></dd></dl>
<dl><dt><a name="-figlegend"><strong>figlegend</strong></a>(handles, labels, loc)</dt><dd><tt>Place a legend in the figure. Labels are a sequence of<br>
strings, handles is a sequence of line or patch instances, and<br>
loc can be a string or an integer specifying the legend<br>
location<br>
<br>
USAGE: <br>
legend( (line1, line2, line3),<br>
('label1', 'label2', 'label3'),<br>
'upper right')<br>
<br>
See help(legend) for information about the location codes<br>
<br>
A matplotlib.legend.Legend instance is returned</tt></dd></dl>
<dl><dt><a name="-figtext"><strong>figtext</strong></a>(*args, **kwargs)</dt><dd><tt>Add text to figure at location x,y (relative 0-1 coords) See<br>
the help for Axis text for the meaning of the other arguments</tt></dd></dl>
<dl><dt><a name="-figure"><strong>figure</strong></a>(num<font color="#909090">=1</font>, figsize<font color="#909090">=None</font>, dpi<font color="#909090">=None</font>, facecolor<font color="#909090">=None</font>, edgecolor<font color="#909090">=None</font>, frameon<font color="#909090">=True</font>)</dt><dd><tt><a href="#-figure">figure</a>(num = 1, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')<br>
<br>
<br>
Create a new figure and return a handle to it<br>
<br>
If <a href="#-figure">figure</a>(num) already exists, make it active and return the<br>
handle to it.<br>
<br>
<a href="#-figure">figure</a>(1)<br>
<br>
figsize - width in height x inches; defaults to rc figure.figsize<br>
dpi - resolution; defaults to rc figure.dpi<br>
facecolor - the background color; defaults to rc figure.facecolor<br>
edgecolor - the border color; defaults to rc figure.edgecolor<br>
<br>
rcParams gives the default values from the .matplotlibrc file</tt></dd></dl>
<dl><dt><a name="-fromstring"><strong>fromstring</strong></a>(...)</dt><dd><tt><a href="#-fromstring">fromstring</a>(string, typecode='l', count=-1) returns a new 1d array initialized from the raw binary data in string. If count is positive, the new array will have count elements, otherwise it's size is determined by the size of string.</tt></dd></dl>
<dl><dt><a name="-gca"><strong>gca</strong></a>(**kwargs)</dt><dd><tt>Return the current axis instance. This can be used to control<br>
axis properties either using set or the Axes methods.<br>
<br>
Example:<br>
<br>
plot(t,s)<br>
<a href="#-set">set</a>(<a href="#-gca">gca</a>(), 'xlim', [0,10]) # set the x axis limits<br>
<br>
or<br>
<br>
plot(t,s)<br>
a = <a href="#-gca">gca</a>()<br>
a.set_xlim([0,10]) # does the same</tt></dd></dl>
<dl><dt><a name="-gcf"><strong>gcf</strong></a>()</dt><dd><tt>Return a handle to the current figure</tt></dd></dl>
<dl><dt><a name="-gci"><strong>gci</strong></a>()</dt><dd><tt>get the current ScalarMappable instance (image or patch<br>
collection), or None if no images or patch collecitons have been<br>
defined. The commands imshow and figimage create images<br>
instances, and the commands pcolor and scatter create patch<br>
collection instances</tt></dd></dl>
<dl><dt><a name="-get"><strong>get</strong></a>(o, s)</dt><dd><tt>Return the value of handle property s<br>
<br>
h is an instance of a class, eg a Line2D or an Axes or Text.<br>
if s is 'somename', this function returns<br>
<br>
o.get_somename()</tt></dd></dl>
<dl><dt><a name="-get_current_fig_manager"><strong>get_current_fig_manager</strong></a>()</dt></dl>
<dl><dt><a name="-get_plot_commands"><strong>get_plot_commands</strong></a>()</dt></dl>
<dl><dt><a name="-gray"><strong>gray</strong></a>()</dt><dd><tt>set the default colormap to gray and apply to current image if any</tt></dd></dl>
<dl><dt><a name="-hold"><strong>hold</strong></a>(b<font color="#909090">=None</font>)</dt><dd><tt>Set the hold state. If hold is None (default), toggle the<br>
hold state. Else set the hold state to boolean value b.<br>
<br>
Eg<br>
<a href="#-hold">hold</a>() # toggle hold<br>
<a href="#-hold">hold</a>(True) # hold is on<br>
<a href="#-hold">hold</a>(False) # hold is off</tt></dd></dl>
<dl><dt><a name="-imread"><strong>imread</strong></a>(*args, **kwargs)</dt><dd><tt>return image file in fname as numerix array<br>
<br>
Return value is a MxNx4 array of 0-1 normalized floats</tt></dd></dl>
<dl><dt><a name="-imshow"><strong>imshow</strong></a>(*args, **kwargs)</dt><dd><tt>IMSHOW(X, cmap=None, norm=None, aspect=None, interpolation=None,<br>
alpha=1.0, vmin=None, vmax=None, origin=None, extent=None)<br>
<br>
IMSHOW(X) - plot image X to current axes, resampling to scale to axes<br>
size (X may be numarray/Numeric array or PIL image)<br>
<br>
IMSHOW(X, **kwargs) - Use keyword args to control image scaling,<br>
colormapping etc. See below for details<br>
<br>
<br>
Display the image in X to current axes. X may be a float array or a<br>
PIL image. If X is a float array, X can have the following shapes<br>
<br>
MxN : luminance (grayscale)<br>
<br>
MxNx3 : RGB<br>
<br>
MxNx4 : RGBA<br>
<br>
A matplotlib.image.AxesImage instance is returned<br>
<br>
The following kwargs are allowed: <br>
<br>
* cmap is a cm colormap instance, eg cm.jet. If None, default to rc<br>
image.cmap value (Ignored when X has RGB(A) information)<br>
<br>
* aspect is one of: free or preserve. if None, default to rc<br>
image.aspect value<br>
<br>
* interpolation is one of: bicubic bilinear blackman100 blackman256<br>
blackman64 nearest sinc144 sinc256 sinc64 spline16 or spline36.<br>
If None, default to rc image.interpolation<br>
<br>
* norm is a matplotlib.colors.normalize instance; default is<br>
normalization(). This scales luminance -> 0-1 (Ignored when X is<br>
PIL image).<br>
<br>
* vmin and vmax are used to scale a luminance image to 0-1. If<br>
either is None, the min and max of the luminance values will be<br>
used. Note if you pass a norm instance, the settings for vmin and<br>
vmax will be ignored.<br>
<br>
* alpha = 1.0 : the alpha blending value<br>
<br>
* origin is either upper or lower, which indicates where the [0,0]<br>
index of the array is in the upper left or lower left corner of<br>
the axes. If None, default to rc image.origin<br>
<br>
* extent is a data xmin, xmax, ymin, ymax for making image plots<br>
registered with data plots. Default is the image dimensions<br>
in pixels</tt></dd></dl>
<dl><dt><a name="-jet"><strong>jet</strong></a>()</dt><dd><tt>set the default colormap to jet and apply to current image if any</tt></dd></dl>
<dl><dt><a name="-load"><strong>load</strong></a>(fname)</dt><dd><tt>Load ASCII data from fname into an array and return the array.<br>
<br>
The data must be regular, same number of values in every row<br>
<br>
fname can be a filename or a file handle<br>
<br>
matfile data is not currently supported, but see<br>
Nigel Wade's matfile <a href="ftp://ion.le.ac.uk/matfile/matfile.tar.gz">ftp://ion.le.ac.uk/matfile/matfile.tar.gz</a><br>
<br>
Example usage:<br>
<br>
x,y = <a href="#-load">load</a>('test.dat') # data in two columns<br>
<br>
X = <a href="#-load">load</a>('test.dat') # a matrix of data<br>
<br>
x = <a href="#-load">load</a>('test.dat') # a single column of data</tt></dd></dl>
<dl><dt><a name="-mpl_connect"><strong>mpl_connect</strong></a>(s, func)</dt><dd><tt>Connect event with string s to func. The signature of func is<br>
<br>
def func(event)<br>
<br>
where event is a MplEvent. The following events are recognized<br>
<br>
'button_press_event' <br>
'button_release_event' <br>
'motion_notify_event' <br>
<br>
For the three events above, if the mouse is over the axes,<br>
the variable event.inaxes will be set to the axes it is over,<br>
and additionally, the variables event.xdata and event.ydata<br>
will be defined. This is the mouse location in data coords.<br>
See backend_bases.MplEvent.<br>
<br>
return value is a connection id that can be used with<br>
mpl_disconnect</tt></dd></dl>
<dl><dt><a name="-mpl_disconnect"><strong>mpl_disconnect</strong></a>(cid)</dt><dd><tt>Connect s to func. return an id that can be used with disconnect<br>
Method should return None</tt></dd></dl>
<dl><dt><a name="-pcolor"><strong>pcolor</strong></a>(*args, **kwargs)</dt><dd><tt>PCOLOR(*args, **kwargs) <br>
<br>
Function signatures<br>
<br>
PCOLOR(C) - make a pseudocolor plot of matrix C<br>
<br>
PCOLOR(X, Y, C) - a pseudo color plot of C on the matrices X and Y<br>
<br>
PCOLOR(C, **kwargs) - Use keywork args to control colormapping and<br>
scaling; see below<br>
<br>
Optional keywork args are shown with their defaults below (you must<br>
use kwargs for these):<br>
<br>
* cmap = cm.jet : a cm Colormap instance from matplotlib.cm.<br>
defaults to cm.jet<br>
<br>
* norm = normalize() : matplotlib.colors.normalize is used to scale<br>
luminance data to 0,1.<br>
<br>
* vmin=None and vmax=None : vmin and vmax are used in conjunction<br>
with norm to normalize luminance data. If either are None, the<br>
min and max of the color array C is used. If you pass a norm<br>
instance, vmin and vmax will be None<br>
<br>
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is<br>
drawn around each rectangle; if 'flat', edge colors are same as<br>
face colors<br>
<br>
* alpha=1.0 : the alpha blending value<br>
<br>
Return value is a matplotlib.collections.PatchCollection<br>
object<br>
<br>
Grid Orientation<br>
<br>
The behavior of meshgrid in matlab is a bit counterintuitive for<br>
x and y arrays. For example,<br>
<br>
x = <a href="#-arange">arange</a>(7)<br>
y = <a href="#-arange">arange</a>(5)<br>
X, Y = meshgrid(x,y)<br>
<br>
Z = rand( len(x), len(y))<br>
<a href="#-pcolor">pcolor</a>(X, Y, Z)<br>
<br>
will fail in matlab and matplotlib. You will probably be<br>
happy with<br>
<br>
<a href="#-pcolor">pcolor</a>(X, Y, transpose(Z))<br>
<br>
Likewise, for nonsquare Z,<br>
<br>
<a href="#-pcolor">pcolor</a>(transpose(Z))<br>
<br>
will make the x and y axes in the plot agree with the numrows and<br>
numcols of Z</tt></dd></dl>
<dl><dt><a name="-plotting"><strong>plotting</strong></a>()</dt><dd><tt>Plotting commands<br>
axes - Create a new axes<br>
axis - Set or return the current axis limits<br>
bar - make a bar chart<br>
cla - clear current axes<br>
clf - clear a figure window<br>
close - close a figure window<br>
colorbar - add a colorbar to the current figure<br>
cohere - make a plot of coherence<br>
csd - make a plot of cross spectral density<br>
draw - force a redraw of the current figure<br>
errorbar - make an errorbar graph<br>
figlegend - add a legend to the figure<br>
figimage - add an image to the figure, w/o resampling<br>
figtext - add text in figure coords<br>
figure - create or change active figure<br>
fill - make filled polygons<br>
gca - return the current axes<br>
gcf - return the current figure<br>
gci - get the current image, or None<br>
get - get a handle graphics property<br>
gray - set the current colormap to gray<br>
jet - set the current colormap to jet<br>
hist - make a histogram<br>
hold - set the hold state on current axes<br>
legend - add a legend to the axes<br>
loglog - a log log plot<br>
imread - load image file into array<br>
imshow - plot image data<br>
pcolor - make a pseudocolor plot<br>
plot - make a line plot<br>
psd - make a plot of power spectral density<br>
rc - control the default params<br>
savefig - save the current figure<br>
scatter - make a scatter plot<br>
set - set a handle graphics property<br>
semilogx - log x axis<br>
semilogy - log y axis<br>
show - show the figures<br>
specgram - a spectrogram plot<br>
stem - make a stem plot<br>
subplot - make a subplot (numrows, numcols, axesnum)<br>
table - add a table to the axes<br>
text - add some text at location x,y to the current axes<br>
title - add a title to the current axes<br>
xlabel - add an xlabel to the current axes<br>
ylabel - add a ylabel to the current axes</tt></dd></dl>
<dl><dt><a name="-polar"><strong>polar</strong></a>(*args, **kwargs)</dt><dd><tt>POLAR(theta, r)<br>
<br>
Make a polar plot. Multiple theta, r arguments are supported,<br>
with format strings, as in plot.</tt></dd></dl>
<dl><dt><a name="-raise_msg_to_str"><strong>raise_msg_to_str</strong></a>(msg)</dt><dd><tt>msg is a return arg from a raise. Join with new lines</tt></dd></dl>
<dl><dt><a name="-rc"><strong>rc</strong></a>(*args, **kwargs)</dt><dd><tt>Set the current rc params. Group is the grouping for the rc, eg<br>
for lines.linewidth the group is 'lines', for axes.facecolor, the<br>
group is 'axes', and so on. kwargs is a list of attribute<br>
name/value pairs, eg<br>
<br>
<a href="#-rc">rc</a>('lines', linewidth=2, color='r')<br>
<br>
sets the current rc params and is equivalent to<br>
<br>
rcParams['lines.linewidth'] = 2<br>
rcParams['lines.color'] = 'r'<br>
<br>
The following aliases are available to save typing for interactive<br>
users<br>
'lw' : 'linewidth'<br>
'ls' : 'linestyle' <br>
'c' : 'color'<br>
'fc' : 'facecolor'<br>
'ec' : 'edgecolor'<br>
'mfc' : 'markerfacecolor'<br>
'mec' : 'markeredgecolor'<br>
'mew' : 'markeredgewidth'<br>
'aa' : 'antialiased' <br>
'l' : 'lines'<br>
'a' : 'axes'<br>
'f' : 'figure'<br>
'p' : 'patches'<br>
'g' : 'grid'<br>
<br>
Thus you could abbreviate the above rc command as<br>
<br>
<a href="#-rc">rc</a>('l', lw=2, c='r')<br>
<br>
<br>
Note you can use python's kwargs dictionary facility to store<br>
dictionaries of default parameters. Eg, you can customize the<br>
font rc as follows<br>
<br>
font = {'family' : 'monospace',<br>
'weight' : 'bold',<br>
'size' : 'larger',<br>
}<br>
<br>
<a href="#-rc">rc</a>('font', **font) # pass in the font dict as kwargs<br>
<br>
This enables you to easily switch between several configurations.<br>
Use rcdefaults to restore the default rc params after changes.</tt></dd></dl>
<dl><dt><a name="-rcdefaults"><strong>rcdefaults</strong></a>()</dt><dd><tt>Restore the default rc params - the ones that were created at<br>
matplotlib load time</tt></dd></dl>
<dl><dt><a name="-reshape"><strong>reshape</strong></a>(...)</dt><dd><tt><a href="#-reshape">reshape</a>(a, (d1, d2, ..., dn)). Change the shape of a to be an n-dimensional array with dimensions given by d1...dn. Note: the size specified for the new array must be exactly equal to the size of the old one or an error will occur.</tt></dd></dl>
<dl><dt><a name="-save"><strong>save</strong></a>(fname, X, fmt<font color="#909090">='%1.4f'</font>)</dt><dd><tt>Save the data in X to file fname using fmt string to convert the<br>
data to strings<br>
<br>
fname can be a filename or a file handle <br>
<br>
Example usage:<br>
<br>
<a href="#-save">save</a>('test.out', X) # X is an array<br>
<a href="#-save">save</a>('test1.out', (x,y,z)) # x,y,z equal sized 1D arrays<br>
<a href="#-save">save</a>('test2.out', x) # x is 1D<br>
<a href="#-save">save</a>('test3.out', x, fmt='%1.4e') # use exponential notation</tt></dd></dl>
<dl><dt><a name="-savefig"><strong>savefig</strong></a>(*args, **kwargs)</dt><dd><tt>SAVEFIG(fname, dpi=150, facecolor='w', edgecolor='w',<br>
orientation='portrait'):<br>
<br>
Save the current figure to filename fname. dpi is the resolution<br>
in dots per inch.<br>
<br>
Output file types currently supported are jpeg and png and will be<br>
deduced by the extension to fname<br>
<br>
facecolor and edgecolor are the colors os the figure rectangle<br>
<br>
orientation is either 'landscape' or 'portrait' - not supported on<br>
all backends; currently only on postscript output.</tt></dd></dl>
<dl><dt><a name="-searchsorted"><strong>searchsorted</strong></a> = binarysearch(...)</dt><dd><tt>binarysearch(a,v)</tt></dd></dl>
<dl><dt><a name="-set"><strong>set</strong></a>(h, *args, **kwargs)</dt><dd><tt>Set handle h property in string s to value val<br>
<br>
h can be a handle or vector of handles.<br>
<br>
h is an instance (or vector of instances) of a class, eg a Line2D<br>
or an Axes or Text.<br>
<br>
args is a list of string, value pairs. if the string<br>
is 'somename', set function calls<br>
<br>
o.set_somename(value)<br>
<br>
for every instance in h.</tt></dd></dl>
<dl><dt><a name="-specgram"><strong>specgram</strong></a>(*args, **kwargs)</dt><dd><tt>SPECGRAM(x, NFFT=256, Fs=2, detrend=mlab.detrend_none,<br>
window=mlab.window_hanning, noverlap=128,<br>
cmap=None, xextent=None)<br>
<br>
Compute a spectrogram of data in x. Data are split into NFFT length<br>
segements and the PSD of each section is computed. The windowing<br>
function window is applied to each segment, and the amount of overlap<br>
of each segment is specified with noverlap. <br>
<br>
* cmap is a colormap; if None use default determined by rc<br>
<br>
* xextent is the image extent in the xaxes xextent=xmin, xmax -<br>
default 0, max(bins), 0, max(freqs) where bins is the return<br>
value from matplotlib.mlab.specgram<br>
<br>
* See help(psd) for information on the other keyword arguments.<br>
<br>
Return value is (Pxx, freqs, bins, im), where<br>
<br>
bins are the time points the spectrogram is calculated over<br>
<br>
freqs is an array of frequencies<br>
<br>
Pxx is a len(times) x len(freqs) array of power<br>
<br>
im is a matplotlib.image.AxesImage.</tt></dd></dl>
<dl><dt><a name="-subplot"><strong>subplot</strong></a>(*args, **kwargs)</dt><dd><tt>Create a subplot command, creating axes with<br>
<br>
<a href="#-subplot">subplot</a>(numRows, numCols, plotNum)<br>
<br>
where plotNum=1 is the first plot number and increasing plotNums<br>
fill rows first. max(plotNum)==numRows*numCols<br>
<br>
You can leave out the commas if numRows<=numCols<=plotNum<10, as<br>
in<br>
<br>
<a href="#-subplot">subplot</a>(211) # 2 rows, 1 column, first (upper) plot<br>
<br>
<a href="#-subplot">subplot</a>(111) is the default axis<br>
<br>
The background color of the subplot can be specified via keyword<br>
argument 'axisbg', which takes a color string or gdk.Color as value, as in<br>
<br>
<a href="#-subplot">subplot</a>(211, axisbg='y')</tt></dd></dl>
<dl><dt><a name="-take"><strong>take</strong></a>(...)</dt><dd><tt><a href="#-take">take</a>(a, indices, axis=0). Selects the elements in indices from array a along the given axis.</tt></dd></dl>
<dl><dt><a name="-title"><strong>title</strong></a>(s, *args, **kwargs)</dt><dd><tt>Set the title of the current axis to s<br>
<br>
Default font override is:<br>
override = {<br>
'fontsize' : 'medium',<br>
'verticalalignment' : 'bottom',<br>
'horizontalalignment' : 'center'<br>
}<br>
<br>
See the text docstring for information of how override and the<br>
optional args work</tt></dd></dl>
<dl><dt><a name="-xlabel"><strong>xlabel</strong></a>(s, *args, **kwargs)</dt><dd><tt>Set the x axis label of the current axis to s<br>
<br>
Default override is<br>
<br>
override = {<br>
'fontsize' : 'small',<br>
'verticalalignment' : 'top',<br>
'horizontalalignment' : 'center'<br>
}<br>
<br>
See the text docstring for information of how override and<br>
the optional args work</tt></dd></dl>
<dl><dt><a name="-xlim"><strong>xlim</strong></a>(*args, **kwargs)</dt><dd><tt>Set/Get the xlimits of the current axes<br>
<br>
xmin, xmax = <a href="#-xlim">xlim</a>() : return the current xlim<br>
<a href="#-xlim">xlim</a>( (xmin, xmax) ) : set the xlim to xmin, xmax<br>
<a href="#-xlim">xlim</a>( xmin, xmax ) : set the xlim to xmin, xmax</tt></dd></dl>
<dl><dt><a name="-xticks"><strong>xticks</strong></a>(*args, **kwargs)</dt><dd><tt>Set/Get the xlimits of the current ticklocs, labels<br>
<br>
# return locs, labels where locs is an array of tick locations and<br>
# labels is an array of tick labels.<br>
locs, labels = <a href="#-xticks">xticks</a>() <br>
<br>
# set the locations of the xticks<br>
<a href="#-xticks">xticks</a>( <a href="#-arange">arange</a>(6) )<br>
<br>
# set the locations and labels of the xticks<br>
<a href="#-xticks">xticks</a>( <a href="#-arange">arange</a>(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )<br>
<br>
The keyword args, if any, are text properties; see text for more<br>
information on text properties.</tt></dd></dl>
<dl><dt><a name="-ylabel"><strong>ylabel</strong></a>(s, *args, **kwargs)</dt><dd><tt>Set the y axis label of the current axis to s<br>
<br>
Defaults override is<br>
<br>
override = {<br>
'fontsize' : 'small',<br>
'verticalalignment' : 'center',<br>
'horizontalalignment' : 'right',<br>
'rotation'='vertical' : }<br>
<br>
See the text docstring for information of how override and the<br>
optional args work</tt></dd></dl>
<dl><dt><a name="-ylim"><strong>ylim</strong></a>(*args, **kwargs)</dt><dd><tt>Set/Get the ylimits of the current axes<br>
<br>
ymin, ymax = <a href="#-ylim">ylim</a>() : return the current ylim<br>
<a href="#-ylim">ylim</a>( (ymin, ymax) ) : set the ylim to ymin, ymax<br>
<a href="#-ylim">ylim</a>( ymin, ymax ) : set the ylim to ymin, ymax</tt></dd></dl>
<dl><dt><a name="-yticks"><strong>yticks</strong></a>(*args, **kwargs)</dt><dd><tt>Set/Get the ylimits of the current ticklocs, labels<br>
<br>
# return locs, labels where locs is an array of tick locations and<br>
# labels is an array of tick labels.<br>
locs, labels = <a href="#-yticks">yticks</a>() <br>
<br>
# set the locations of the yticks<br>
<a href="#-yticks">yticks</a>( <a href="#-arange">arange</a>(6) )<br>
<br>
# set the locations and labels of the yticks<br>
<a href="#-yticks">yticks</a>( <a href="#-arange">arange</a>(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue') )<br>
<br>
The keyword args, if any, are text properties; see text for more<br>
information on text properties.</tt></dd></dl>
<dl><dt><a name="-zeros"><strong>zeros</strong></a>(...)</dt><dd><tt><a href="#-zeros">zeros</a>((d1,...,dn),typecode='l',savespace=0) will return a new array of shape (d1,...,dn) and type typecode with all it's entries initialized to zero. If savespace is nonzero the array will be a spacesaver array.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>Character</strong> = 'c'<br>
<strong>Complex</strong> = 'D'<br>
<strong>Complex0</strong> = 'F'<br>
<strong>Complex16</strong> = 'F'<br>
<strong>Complex32</strong> = 'F'<br>
<strong>Complex64</strong> = 'D'<br>
<strong>Complex8</strong> = 'F'<br>
<strong>DAILY</strong> = 3<br>
<strong>FR</strong> = FR<br>
<strong>FRIDAY</strong> = FR<br>
<strong>False</strong> = False<br>
<strong>Float</strong> = 'd'<br>
<strong>Float0</strong> = 'f'<br>
<strong>Float16</strong> = 'f'<br>
<strong>Float32</strong> = 'f'<br>
<strong>Float64</strong> = 'd'<br>
<strong>Float8</strong> = 'f'<br>
<strong>HOURLY</strong> = 4<br>
<strong>HOURS_PER_DAY</strong> = 24.0<br>
<strong>Infinity</strong> = inf<br>
<strong>Int</strong> = 'l'<br>
<strong>Int0</strong> = '1'<br>
<strong>Int16</strong> = 's'<br>
<strong>Int32</strong> = 'i'<br>
<strong>Int8</strong> = '1'<br>
<strong>LittleEndian</strong> = True<br>
<strong>MINUTELY</strong> = 5<br>
<strong>MINUTES_PER_DAY</strong> = 1440.0<br>
<strong>MO</strong> = MO<br>
<strong>MONDAY</strong> = MO<br>
<strong>MONTHLY</strong> = 1<br>
<strong>MUSECONDS_PER_DAY</strong> = 86400000000.0<br>
<strong>NewAxis</strong> = None<br>
<strong>PyObject</strong> = 'O'<br>
<strong>SA</strong> = SA<br>
<strong>SATURDAY</strong> = SA<br>
<strong>SECONDLY</strong> = 6<br>
<strong>SECONDS_PER_DAY</strong> = 86400.0<br>
<strong>SEC_PER_DAY</strong> = 86400<br>
<strong>SEC_PER_HOUR</strong> = 3600<br>
<strong>SEC_PER_MIN</strong> = 60<br>
<strong>SEC_PER_WEEK</strong> = 604800<br>
<strong>SU</strong> = SU<br>
<strong>SUNDAY</strong> = SU<br>
<strong>TH</strong> = TH<br>
<strong>THURSDAY</strong> = TH<br>
<strong>TU</strong> = TU<br>
<strong>TUESDAY</strong> = TU<br>
<strong>True</strong> = True<br>
<strong>UInt</strong> = 'u'<br>
<strong>UInt16</strong> = 'w'<br>
<strong>UInt32</strong> = 'u'<br>
<strong>UInt8</strong> = 'b'<br>
<strong>UnsignedInt16</strong> = 'w'<br>
<strong>UnsignedInt32</strong> = 'u'<br>
<strong>UnsignedInt8</strong> = 'b'<br>
<strong>UnsignedInteger</strong> = 'u'<br>
<strong>WE</strong> = WE<br>
<strong>WEDNESDAY</strong> = WE<br>
<strong>WEEKDAYS</strong> = (MO, TU, WE, TH, FR, SA, SU)<br>
<strong>WEEKLY</strong> = 2<br>
<strong>YEARLY</strong> = 0<br>
<strong>absolute</strong> = <ufunc 'absolute'><br>
<strong>add</strong> = <ufunc 'add'><br>
<strong>arccos</strong> = <ufunc 'arccos'><br>
<strong>arccosh</strong> = <ufunc 'arccosh'><br>
<strong>arcsin</strong> = <ufunc 'arcsin'><br>
<strong>arcsinh</strong> = <ufunc 'arcsinh'><br>
<strong>arctan</strong> = <ufunc 'arctan'><br>
<strong>arctan2</strong> = <ufunc 'arctan2'><br>
<strong>arctanh</strong> = <ufunc 'arctanh'><br>
<strong>bitwise_and</strong> = <ufunc 'bitwise_and'><br>
<strong>bitwise_or</strong> = <ufunc 'bitwise_or'><br>
<strong>bitwise_xor</strong> = <ufunc 'bitwise_xor'><br>
<strong>ceil</strong> = <ufunc 'ceil'><br>
<strong>conjugate</strong> = <ufunc 'conjugate'><br>
<strong>cos</strong> = <ufunc 'cos'><br>
<strong>cosh</strong> = <ufunc 'cosh'><br>
<strong>divide</strong> = <ufunc 'divide'><br>
<strong>divide_safe</strong> = <ufunc 'divide_safe'><br>
<strong>division</strong> = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)<br>
<strong>e</strong> = 2.7182818284590451<br>
<strong>equal</strong> = <ufunc 'equal'><br>
<strong>exp</strong> = <ufunc 'exp'><br>
<strong>exp_safe_MAX</strong> = 1.7976931348623157e+308<br>
<strong>exp_safe_MIN</strong> = -708.39641853226408<br>
<strong>fabs</strong> = <ufunc 'fabs'><br>
<strong>floor</strong> = <ufunc 'floor'><br>
<strong>floor_divide</strong> = <ufunc 'floor_divide'><br>
<strong>fmod</strong> = <ufunc 'fmod'><br>
<strong>greater</strong> = <ufunc 'greater'><br>
<strong>greater_equal</strong> = <ufunc 'greater_equal'><br>
<strong>hypot</strong> = <ufunc 'hypot'><br>
<strong>inf</strong> = inf<br>
<strong>infty</strong> = inf<br>
<strong>invert</strong> = <ufunc 'invert'><br>
<strong>left_shift</strong> = <ufunc 'left_shift'><br>
<strong>less</strong> = <ufunc 'less'><br>
<strong>less_equal</strong> = <ufunc 'less_equal'><br>
<strong>log</strong> = <ufunc 'log'><br>
<strong>log10</strong> = <ufunc 'log10'><br>
<strong>logical_and</strong> = <ufunc 'logical_and'><br>
<strong>logical_not</strong> = <ufunc 'logical_not'><br>
<strong>logical_or</strong> = <ufunc 'logical_or'><br>
<strong>logical_xor</strong> = <ufunc 'logical_xor'><br>
<strong>maximum</strong> = <ufunc 'maximum'><br>
<strong>minimum</strong> = <ufunc 'minimum'><br>
<strong>multiply</strong> = <ufunc 'multiply'><br>
<strong>name</strong> = 'vlines'<br>
<strong>negative</strong> = <ufunc 'negative'><br>
<strong>not_equal</strong> = <ufunc 'not_equal'><br>
<strong>nx</strong> = <matplotlib.nc_imports._TypeNamespace instance><br>
<strong>pi</strong> = 3.1415926535897931<br>
<strong>power</strong> = <ufunc 'power'><br>
<strong>rcParams</strong> = {'axes.edgecolor': 'k', 'axes.facecolor': 'w', 'axes.grid': False, 'axes.hold': True, 'axes.labelcolor': 'k', 'axes.labelsize': 12.0, 'axes.linewidth': 1.0, 'axes.titlesize': 14.0, 'backend': 'GTKAgg', 'datapath': '/usr/local/share/matplotlib', ...}<br>
<strong>rcParamsDefault</strong> = {'axes.edgecolor': 'k', 'axes.facecolor': 'w', 'axes.grid': False, 'axes.hold': True, 'axes.labelcolor': 'k', 'axes.labelsize': 12.0, 'axes.linewidth': 1.0, 'axes.titlesize': 14.0, 'backend': 'GTKAgg', 'datapath': '/usr/local/share/matplotlib', ...}<br>
<strong>readme</strong> = '<font color="#c040c0">\n</font>MLab2.py, release 1<font color="#c040c0">\n\n</font>Created on February 2003 b...<font color="#c040c0">\n</font>Look at: http://pdilib.sf.net for new releases.<font color="#c040c0">\n</font>'<br>
<strong>remainder</strong> = <ufunc 'remainder'><br>
<strong>right_shift</strong> = <ufunc 'right_shift'><br>
<strong>sin</strong> = <ufunc 'sin'><br>
<strong>sinh</strong> = <ufunc 'sinh'><br>
<strong>sqrt</strong> = <ufunc 'sqrt'><br>
<strong>subtract</strong> = <ufunc 'subtract'><br>
<strong>tan</strong> = <ufunc 'tan'><br>
<strong>tanh</strong> = <ufunc 'tanh'><br>
<strong>true_divide</strong> = <ufunc 'true_divide'><br>
<strong>typecodes</strong> = {'Character': 'c', 'Complex': 'FD', 'Float': 'fd', 'Integer': '1sil', 'UnsignedInteger': 'bwu'}<br>
<strong>verbose</strong> = <matplotlib.Verbose instance><br>
<strong>version</strong> = 'Numeric 23.1'<br>
<strong>which</strong> = ('numeric', 'rc')</td></tr></table>
@footer@