800 lines (797 with data), 63.7 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="/matplotlib/matlab.py">/matplotlib/matlab.py</a></font></td></tr></table>
<p><tt>This is a matlab style functional interface the matplotlib.<br>
<br>
The following matlab compatible commands are provided<br>
<br>
Plotting commands<br>
<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>
cohere - make a plot of coherence<br>
csd - make a plot of cross spectral density<br>
errorbar - make an errorbar graph<br>
figure - create or change active figure<br>
gca - return the current axes<br>
gcf - return the current figure<br>
get - get a handle graphics property<br>
hist - make a histogram<br>
loglog - a log log plot<br>
pcolor - make a pseudocolor plot<br>
plot - make a line plot<br>
psd - make a plot of power spectral density<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>
subplot - make a subplot (numrows, numcols, axesnum)<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<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>
Other<br>
<br>
angle - the angle of a complex 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>
trapz - trapezoidal integration<br>
<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>
</td><td width="25%" valign=top><a href="matplotlib._matlab_helpers.html">matplotlib._matlab_helpers</a><br>
<a href="copy.html">copy</a><br>
<a href="copy_reg.html">copy_reg</a><br>
<a href="math.html">math</a><br>
</td><td width="25%" valign=top><a href="matplotlib.mlab.html">matplotlib.mlab</a><br>
<a href="multiarray.html">multiarray</a><br>
<a href="pickle.html">pickle</a><br>
<a href="string.html">string</a><br>
</td><td width="25%" valign=top><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 axis 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 background is the background color for<br>
the 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<br>
<br>
axisbg is a color format string which sets the background color of<br>
the axes<br>
<br>
If axisbg is a length 1 string, assume it's a color format string<br>
(see plot for legal color strings). If it is a length 7 string,<br>
assume it's a hex color string, as used in html, eg, '#eeefff'.<br>
If it is a len(3) tuple, assume it's an rgb value where r,g,b in<br>
[0,1].</tt></dd></dl>
<dl><dt><a name="-axis"><strong>axis</strong></a>(*v)</dt><dd><tt><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<br>
x and y axis limits<br>
<br>
<a href="#-axis">axis</a>('off') turns off the axis lines and labels</tt></dd></dl>
<dl><dt><a name="-bar"><strong>bar</strong></a>(*args, **kwargs)</dt><dd><tt>BAR(left, height)<br>
<br>
Make a bar plot with rectangles at<br>
left, left+width, 0, height<br>
left and height are Numeric arrays<br>
<br>
Return value is a list of Rectangle patch instances<br>
<br>
BAR(left, height, width, bottom,<br>
color, yerr, xerr, capsize, yoff)<br>
<br>
xerr and yerr, if not None, will be used to generate errorbars<br>
on the bar chart<br>
<br>
color specifies the color of the bar<br>
<br>
capsize determines the length in points of the error bar caps<br>
<br>
<br>
The optional arguments color, width and bottom can be either<br>
scalars or len(x) sequences<br>
<br>
This enables you to use bar as the basis for stacked bar<br>
charts, or candlestick plots</tt></dd></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="-cla"><strong>cla</strong></a>()</dt><dd><tt>Clear the current axes</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="-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="-cohere"><strong>cohere</strong></a>(x, y, NFFT<font color="#909090">=256</font>, Fs<font color="#909090">=2</font>, detrend<font color="#909090">=<function detrend_none></font>, window<font color="#909090">=<function window_hanning></font>, noverlap<font color="#909090">=0</font>)</dt><dd><tt>Compute the coherence between x and y. Coherence is the<br>
normalized cross spectral density<br>
<br>
Cxy = |Pxy|^2/(Pxx*Pyy)<br>
<br>
The return value is (Cxy, f), where f are the frequencies of the<br>
coherence vector. See the docs for psd and csd for information<br>
about the function arguments NFFT, detrend, windowm noverlap, as<br>
well as the methods used to compute Pxy, Pxx and Pyy.<br>
<br>
Returns the tuple Cxy, freqs<br>
<br>
Refs:<br>
Bendat & Piersol -- Random Data: Analysis and Measurement<br>
Procedures, John Wiley & Sons (1986)</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="-csd"><strong>csd</strong></a>(x, y, NFFT<font color="#909090">=256</font>, Fs<font color="#909090">=2</font>, detrend<font color="#909090">=<function detrend_none></font>, window<font color="#909090">=<function window_hanning></font>, noverlap<font color="#909090">=0</font>)</dt><dd><tt>The cross spectral density Pxy by Welches average periodogram<br>
method. The vectors x and y are divided into NFFT length<br>
segments. Each segment is detrended by function detrend and<br>
windowed by function window. noverlap gives the length of the<br>
overlap between segments. The product of the direct FFTs of x and<br>
y are averaged over each segment to compute Pxy, with a scaling to<br>
correct for power loss due to windowing. Fs is the sampling<br>
frequency.<br>
<br>
NFFT must be a power of 2<br>
<br>
detrend and window are functions, unlike in matlab where they are<br>
vectors. For detrending you can use detrend_none, detrend_mean,<br>
detrend_linear or a custom function. For windowing, you can use<br>
window_none, window_hanning, or a custom function<br>
<br>
Returns the tuple Pxy, freqs. Pxy is the cross spectrum (complex<br>
valued), and 10*log10(|Pxy|) is plotted<br>
<br>
Refs:<br>
Bendat & Piersol -- Random Data: Analysis and Measurement<br>
Procedures, John Wiley & Sons (1986)</tt></dd></dl>
<dl><dt><a name="-errorbar"><strong>errorbar</strong></a>(x, y, yerr<font color="#909090">=None</font>, xerr<font color="#909090">=None</font>, fmt<font color="#909090">='b-'</font>, capsize<font color="#909090">=3</font>)</dt><dd><tt>Plot x versus y with error deltas in yerr and xerr.<br>
Vertical errorbars are plotted if yerr is not None<br>
Horizontal errorbars are plotted if xerr is not None<br>
<br>
xerr and yerr may be any of:<br>
a rank-0, Nx1 Numpy array - symmetric errorbars +/- value<br>
an N-element list or tuple - symmetric errorbars +/- value<br>
a rank-1, Nx2 Numpy array - asymmetric errorbars -column1/+column2<br>
<br>
fmt is the plot format symbol for y<br>
<br>
Return value is a length 2 tuple. The first element is a list of<br>
y symbol lines. The second element is a list of error bar lines.<br>
<br>
capsize is the size of the error bar caps in points</tt></dd></dl>
<dl><dt><a name="-figure"><strong>figure</strong></a>(num<font color="#909090">=1</font>, figsize<font color="#909090">=(8, 6)</font>, dpi<font color="#909090">=72</font>, facecolor<font color="#909090">=0.75</font>, edgecolor<font color="#909090">='w'</font>)</dt><dd><tt>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)</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>()</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>
<a href="#-plot">plot</a>(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>
<a href="#-plot">plot</a>(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="-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="-grid"><strong>grid</strong></a>(b)</dt><dd><tt>Set the figure grid to be on or off (b is a boolean)</tt></dd></dl>
<dl><dt><a name="-hist"><strong>hist</strong></a>(x, bins<font color="#909090">=10</font>, noplot<font color="#909090">=0</font>, normed<font color="#909090">=0</font>)</dt><dd><tt>Compute the histogram of x. bins is either an integer number of<br>
bins or a sequence giving the bins. x are the data to be binned.<br>
<br>
if noplot is True, just compute the histogram and return the<br>
number of observations and the bins as an (n, bins) tuple.<br>
<br>
If noplot is False, compute the histogram and plot it, returning<br>
n, bins, patches<br>
<br>
If normed is true, the first element of the return tuple will be the<br>
counts normalized to form a probability distribtion, ie,<br>
n/(len(x)*dbin)</tt></dd></dl>
<dl><dt><a name="-hlines"><strong>hlines</strong></a>(*args, **kwargs)</dt><dd><tt>lines = <a href="#-hlines">hlines</a>(self, y, xmin, xmax, fmt='k-')<br>
<br>
plot horizontal lines at each y from xmin to xmax. xmin or<br>
xmax can be scalars or len(x) numpy arrays. If they are<br>
scalars, then the respective values are constant, else the<br>
widths of the lines are determined by xmin and xmax<br>
<br>
Returns a list of line instances that were added</tt></dd></dl>
<dl><dt><a name="-legend"><strong>legend</strong></a>(*args, **kwargs)</dt><dd><tt>Place a legend on the current axes at location loc. Labels are a<br>
sequence of strings and loc can be a string or an integer<br>
specifying the legend location<br>
<br>
USAGE: <br>
<br>
Make a legend with existing lines<br>
<a href="#-legend">legend</a>( LABELS )<br>
>>> <a href="#-legend">legend</a>( ('label1', 'label2', 'label3') ) <br>
<br>
Make a legend for Line2D instances lines1, line2, line3<br>
<a href="#-legend">legend</a>( LINES, LABELS )<br>
>>> <a href="#-legend">legend</a>( (line1, line2, line3), ('label1', 'label2', 'label3') )<br>
<br>
Make a legend at LOC<br>
<a href="#-legend">legend</a>( LABELS, LOC ) or<br>
<a href="#-legend">legend</a>( LINES, LABELS, LOC )<br>
>>> <a href="#-legend">legend</a>( ('label1', 'label2', 'label3'), loc='upper left')<br>
>>> <a href="#-legend">legend</a>( (line1, line2, line3),<br>
('label1', 'label2', 'label3'),<br>
loc=2)<br>
<br>
The LOC location codes are<br>
<br>
The location codes are<br>
<br>
'best' : 0, (currently not supported, defaults to upper right)<br>
'upper right' : 1, (default)<br>
'upper left' : 2,<br>
'lower left' : 3,<br>
'lower right' : 4,<br>
'right' : 5,<br>
'center left' : 6,<br>
'center right' : 7,<br>
'lower center' : 8,<br>
'upper center' : 9,<br>
'center' : 10,<br>
<br>
Return value is a sequence of text, line instances that make<br>
up the legend</tt></dd></dl>
<dl><dt><a name="-loglog"><strong>loglog</strong></a>(*args, **kwargs)</dt><dd><tt>Make a loglog plot with log scaling on the a and y axis. The args<br>
to semilog x are the same as the args to plot. See help plot for<br>
more info</tt></dd></dl>
<dl><dt><a name="-pcolor"><strong>pcolor</strong></a>(*args, **kwargs)</dt><dd><tt><a href="#-pcolor">pcolor</a>(C) - make a pseudocolor plot of matrix C<br>
<br>
<a href="#-pcolor">pcolor</a>(X, Y, C) - a pseudo color plot of C on the matrices X and Y <br>
<br>
Shading:<br>
<br>
The optional keyword arg shading ('flat' or 'faceted') will<br>
determine whether the black grid is drawn around each pcolor<br>
square. Defaul 'faceteted'<br>
e.g., <br>
<a href="#-pcolor">pcolor</a>(C, shading='flat') <br>
<a href="#-pcolor">pcolor</a>(X, Y, C, shading='faceted')<br>
<br>
returns a list of patch objects.<br>
<br>
Note, the behavior of meshgrid in matlab is a bit<br>
counterintuitive for 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<br>
and numcols of Z</tt></dd></dl>
<dl><dt><a name="-plot"><strong>plot</strong></a>(*args, **kwargs)</dt><dd><tt> plot lines. *args is a variable length argument, allowing for<br>
multiple x, y pairs with an optional format string. For<br>
example, all of the following are legal<br>
<br>
<a href="#-plot">plot</a>(x,y) # plot Numeric arrays y vs x<br>
<a href="#-plot">plot</a>(x,y, 'bo') # plot Numeric arrays y vs x with blue circles<br>
<a href="#-plot">plot</a>(y) # plot y using x = <a href="#-arange">arange</a>(len(y))<br>
<a href="#-plot">plot</a>(y, 'r+') # ditto with red plusses<br>
<br>
An arbitrary number of x, y, fmt groups can be specified, as in <br>
<br>
<a href="#-plot">plot</a>(x1, y1, 'g^', x2, y2, 'l-') <br>
<br>
Return value is a list of lines that were added<br>
<br>
The following line styles are supported:<br>
<br>
- : solid line<br>
-- : dashed line<br>
-. : dash-dot line<br>
: : dotted line<br>
. : points<br>
, : pixels<br>
o : circle symbols<br>
^ : triangle up symbols<br>
v : triangle down symbols<br>
< : triangle left symbols<br>
> : triangle right symbols<br>
s : square symbols<br>
+ : plus symbols<br>
<br>
The following color strings are supported<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>
Line styles and colors are combined in a single format string</tt></dd></dl>
<dl><dt><a name="-plotting"><strong>plotting</strong></a>()</dt><dd><tt>Plotting commands<br>
<br>
axes - Create a new axes<br>
axis - Set or return the current axis limits<br>
bar - make a bar chart<br>
cla - clear the current axes <br>
clf - clear the current figure window<br>
close - close the current figure window<br>
cohere - make a plot of coherence<br>
csd - make a plot of cross spectral density<br>
errorbar - make an errorbar graph<br>
figure - create or change active figure<br>
gca - return the current axes<br>
gcf - return the current figure<br>
get - get a handle graphics property<br>
hist - make a histogram<br>
loglog - a log log plot<br>
pcolor - make a pseudocolor plot<br>
plot - make a line plot<br>
psd - make a plot of power spectral density<br>
savefig - save the current figure<br>
scatter - make a scatter plot<br>
semilogx - log x axis<br>
semilogy - log y axis<br>
set - set a handle graphics property<br>
show - show the figures<br>
subplot - make a subplot (numrows, numcols, axesnum)<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="-psd"><strong>psd</strong></a>(x, NFFT<font color="#909090">=256</font>, Fs<font color="#909090">=2</font>, detrend<font color="#909090">=<function detrend_none></font>, window<font color="#909090">=<function window_hanning></font>, noverlap<font color="#909090">=0</font>)</dt><dd><tt>The power spectral density by Welches average periodogram method.<br>
The vector x is divided into NFFT length segments. Each segment<br>
is detrended by function detrend and windowed by function window.<br>
noperlap gives the length of the overlap between segments. The<br>
absolute(fft(segment))**2 of each segment are averaged to compute Pxx,<br>
with a scaling to correct for power loss due to windowing. Fs is<br>
the sampling frequency.<br>
<br>
-- NFFT must be a power of 2<br>
<br>
-- detrend and window are functions, unlike in matlab where they<br>
are vectors. For detrending you can use detrend_none,<br>
detrend_mean, detrend_linear or a custom function. For<br>
windowing, you can use window_none, window_hanning, or a custom<br>
function<br>
<br>
-- if length x < NFFT, it will be zero padded to NFFT<br>
<br>
<br>
Returns the tuple Pxx, freqs<br>
<br>
For plotting, the power is plotted as 10*log10(pxx)) for decibels,<br>
though pxx itself is returned<br>
<br>
Refs:<br>
Bendat & Piersol -- Random Data: Analysis and Measurement<br>
Procedures, John Wiley & Sons (1986)</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="-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="-savefig"><strong>savefig</strong></a>(fname, dpi<font color="#909090">=150</font>, facecolor<font color="#909090">='w'</font>, edgecolor<font color="#909090">='w'</font>)</dt><dd><tt>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.</tt></dd></dl>
<dl><dt><a name="-scatter"><strong>scatter</strong></a>(*args, **kwargs)</dt><dd><tt><a href="#-scatter">scatter</a>(self, x, y, s=None, c='b'):<br>
<br>
Make a scatter plot of x versus y. s is a size (in data<br>
coords) and can be either a scalar or an array of the same<br>
length as x or y. c is a color and can be a single color<br>
format string or an length(x) array of intensities which will<br>
be mapped by the colormap jet. <br>
<br>
If size is None a default size will be used</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="-semilogx"><strong>semilogx</strong></a>(*args, **kwargs)</dt><dd><tt>Make a semilog plot with log scaling on the x axis. The args to<br>
semilog x are the same as the args to plot. See help plot for<br>
more info</tt></dd></dl>
<dl><dt><a name="-semilogy"><strong>semilogy</strong></a>(*args, **kwargs)</dt><dd><tt>Make a semilog plot with log scaling on the y axis. The args to<br>
semilog x are the same as the args to plot. See help plot for<br>
more info</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="-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="-table"><strong>table</strong></a>(*args, **kwargs)</dt><dd><tt><a href="#-table">table</a>(cellText=None, cellColours=None,<br>
cellLoc='right', colWidths=None,<br>
rowLabels=None, rowColours=None, rowLoc='left',<br>
colLabels=None, colColours=None, colLoc='center',<br>
loc='bottom', bbox=None):<br>
<br>
Add a table to the current axes. Returns a table instance. For<br>
finer grained control over tables, use the Table class and add it<br>
to the axes with add_table.<br>
<br>
Thanks to John Gill for providing the class and table.</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="-text"><strong>text</strong></a>(x, y, label, fontdict<font color="#909090">=None</font>, **kwargs)</dt><dd><tt>Add text to axis at location x,y<br>
<br>
fontdict is a dictionary to override the default text properties.<br>
If fontdict is None, the default is<br>
<br>
'fontsize' : 9,<br>
'verticalalignment' : 'bottom',<br>
'horizontalalignment' : 'left'<br>
<br>
**kwargs can in turn be used to override the fontdict, as in<br>
<br>
a.<a href="#-text">text</a>(x,y,label, fontsize=12)<br>
<br>
This command supplies no override dict, and so will have<br>
'verticalalignment'='bottom' and 'horizontalalignment'='left' but<br>
the keyword arg 'fontsize' will create a fontsize of 12<br>
<br>
The purpose these options is to make it easy for you to create a<br>
default font theme for your plots by creating a single dictionary,<br>
and then being able to selective change individual attributes for<br>
the varous text creation commands, as in<br>
<br>
fonts = {<br>
'color' : 'k',<br>
'fontname' : 'Courier',<br>
'fontweight' : 'bold'<br>
}<br>
<br>
<a href="#-title">title</a>('My title', fonts, fontsize=12)<br>
<a href="#-xlabel">xlabel</a>('My xlabel', fonts, fontsize=10)<br>
<a href="#-ylabel">ylabel</a>('My ylabel', fonts, fontsize=10)<br>
<a href="#-text">text</a>(12, 20, 'some text', fonts, fontsize=8)<br>
<br>
The Text defaults are<br>
<br>
'color' : 'k',<br>
'fontname' : 'Sans',<br>
'fontsize' : 10,<br>
'fontweight' : 'bold',<br>
'fontangle' : 'normal',<br>
'horizontalalignment' : 'left'<br>
'rotation' : 'horizontal',<br>
'verticalalignment' : 'bottom',<br>
'transx' : <a href="#-gca">gca</a>().xaxis.transData,<br>
'transy' : <a href="#-gca">gca</a>().yaxis.transData, <br>
<br>
transx and transy specify that text is in data coords,<br>
alternatively, you can specify text in axis coords (0,0 lower<br>
left and 1,1 upper right). The example below places text in<br>
the center of the axes<br>
<br>
ax = <a href="#-subplot">subplot</a>(111)<br>
<a href="#-text">text</a>(0.5, 0.5,'matplotlib', <br>
horizontalalignment='center',<br>
verticalalignment='center',<br>
transx = ax.xaxis.transAxis,<br>
transy = ax.yaxis.transAxis,<br>
)</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' : 11,<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="-vlines"><strong>vlines</strong></a>(*args, **kwargs)</dt><dd><tt>lines = <a href="#-vlines">vlines</a>(x, ymin, ymax, color='k'):<br>
<br>
Plot vertical lines at each x from ymin to ymax. ymin or ymax<br>
can be scalars or len(x) numpy arrays. If they are scalars,<br>
then the respective values are constant, else the heights of<br>
the lines are determined by ymin and ymax<br>
<br>
Returns a list of lines that were added</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' : 10,<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="-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' : 10,<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="-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>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>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>NewAxis</strong> = None<br>
<strong>PrecisionError</strong> = 'PrecisionError'<br>
<strong>PyObject</strong> = 'O'<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>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>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>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>negative</strong> = <ufunc 'negative'><br>
<strong>not_equal</strong> = <ufunc 'not_equal'><br>
<strong>pi</strong> = 3.1415926535897931<br>
<strong>power</strong> = <ufunc 'power'><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'}</td></tr></table>
@footer@