| | |
- matplotlib.artist.Artist(__builtin__.object)
-
- Axes
- SubplotBase
-
- AxesSubplot(SubplotBase, Axes)
class Axes(matplotlib.artist.Artist) |
| |
The Axes contains most of the figure elements: Axis, Tick, Line2D,
Text, Polygon etc, and sets the coordinate system
The Axes instance supports callbacks through a callbacks attribute
which is a cbook.CallbackRegistry instance. The events you can
connect to are 'xlim_changed' and 'ylim_changed' and the callback
will be called with func(ax) where ax is the Axes instance |
| |
- Method resolution order:
- Axes
- matplotlib.artist.Artist
- __builtin__.object
Methods defined here:
- __init__(self, fig, rect, axisbg=None, frameon=True, sharex=None, sharey=None, label='', **kwargs)
- __str__(self)
- acorr(self, x, **kwargs)
- call signature::
acorr(x, normed=False, detrend=mlab.detrend_none, usevlines=False,
maxlags=None, **kwargs)
Plot the autocorrelation of x. If normed=True, normalize the
data but the autocorrelation at 0-th lag. x is detrended by
the detrend callable (default no normalization.
data are plotted as ``plot(lags, c, **kwargs)``
return value is lags, c, line where lags are a length
2*maxlags+1 lag vector, c is the 2*maxlags+1 auto correlation
vector, and line is a Line2D instance returned by plot. The
default linestyle is None and the default marker is 'o',
though these can be overridden with keyword args. The cross
correlation is performed with numpy correlate with
mode=2.
If usevlines is True, Axes.vlines rather than Axes.plot is used
to draw vertical lines from the origin to the acorr.
Otherwise the plotstyle is determined by the kwargs, which are
Line2D properties. If usevlines, the return value is lags, c,
linecol, b where linecol is the collections.LineCollection and b is the x-axis
if usevlines=True, kwargs are passed onto Axes.vlines
if usevlines=False, kwargs are passed onto Axes.plot
maxlags is a positive integer detailing the number of lags to show.
The default value of None will return all (2*len(x)-1) lags.
See the respective function for documentation on valid kwargs
- add_artist(self, a)
- Add any artist to the axes
- add_collection(self, collection, autolim=True)
- add a Collection instance to Axes
- add_line(self, line)
- Add a line to the list of plot lines
- add_patch(self, p)
- Add a patch to the list of Axes patches; the clipbox will be
set to the Axes clipping box. If the transform is not set, it
wil be set to self.transData.
- add_table(self, tab)
- Add a table instance to the list of axes tables
- annotate(self, *args, **kwargs)
- call signature::
annotate(s, xy,
xytext=None,
xycoords='data',
textcoords='data',
arrowprops=None,
**props)
Annotate the x,y point xy with text s at x,y location xytext
(xytext if None defaults to xy and textcoords if None defaults
to xycoords).
arrowprops, if not None, is a dictionary of line properties
(see matplotlib.lines.Line2D) for the arrow that connects
annotation to the point. Valid keys are
========= ===========================================================
Key Description
========= ===========================================================
width the width of the arrow in points
frac the fraction of the arrow length occupied by the head
headwidth the width of the base of the arrow head in points
shrink often times it is convenient to have the arrowtip
and base a bit away from the text and point being
annotated. If d is the distance between the text and
annotated point, shrink will shorten the arrow so the tip
and base are shink percent of the distance d away from the
endpoints. ie, shrink=0.05 is 5%
? any key for matplotlib.patches.polygon
========= ===========================================================
xycoords and textcoords are strings that indicate the
coordinates of xy and xytext.
================= ===================================================
Property Description
================= ===================================================
'figure points' points from the lower left corner of the figure
'figure pixels' pixels from the lower left corner of the figure
'figure fraction' 0,0 is lower left of figure and 1,1 is upper, right
'axes points' points from lower left corner of axes
'axes pixels' pixels from lower left corner of axes
'axes fraction' 0,1 is lower left of axes and 1,1 is upper right
'data' use the coordinate system of the object being
annotated (default)
'offset points' Specify an offset (in points) from the xy value
'polar' you can specify theta, r for the annotation, even
in cartesian plots. Note that if you
are using a polar axes, you do not need
to specify polar for the coordinate
system since that is the native"data" coordinate
system.
================= ===================================================
If a points or pixels option is specified, values will be
added to the left, bottom and if negative, values will be
subtracted from the top, right. Eg::
# 10 points to the right of the left border of the axes and
# 5 points below the top border
xy=(10,-5), xycoords='axes points'
Additional kwargs are Text properties:
alpha: float
animated: [True | False]
axes: an axes instance
backgroundcolor: any matplotlib color
bbox: rectangle prop dict plus key 'pad' which is a pad in points
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
color: any matplotlib color
contains: unknown
family: [ 'serif' | 'sans-serif' | 'cursive' | 'fantasy' | 'monospace' ]
figure: a matplotlib.figure.Figure instance
fontproperties: a matplotlib.font_manager.FontProperties instance
horizontalalignment or ha: [ 'center' | 'right' | 'left' ]
label: any string
linespacing: float
lod: [True | False]
multialignment: ['left' | 'right' | 'center' ]
name or fontname: string eg, ['Sans' | 'Courier' | 'Helvetica' ...]
picker: [None|float|boolean|callable]
position: (x,y)
rotation: [ angle in degrees 'vertical' | 'horizontal'
size or fontsize: [ size in points | relative size eg 'smaller', 'x-large' ]
style or fontstyle: [ 'normal' | 'italic' | 'oblique']
text: string or anything printable with '%s' conversion
transform: a matplotlib.transform transformation instance
variant: [ 'normal' | 'small-caps' ]
verticalalignment or va: [ 'center' | 'top' | 'bottom' | 'baseline' ]
visible: [True | False]
weight or fontweight: [ 'normal' | 'bold' | 'heavy' | 'light' | 'ultrabold' | 'ultralight']
x: float
y: float
zorder: any number
- apply_aspect(self, position=None)
- Use self._aspect and self._adjustable to modify the
axes box or the view limits.
- arrow(self, x, y, dx, dy, **kwargs)
- Draws arrow on specified axis from (x,y) to (x+dx,y+dy).
Optional kwargs control the arrow properties:
aa: [True | False] or None for default
alpha: float
animated: [True | False]
antialiased: [True | False] or None for default
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
contains: unknown
ec: mpl color spec, or None for default, or 'none' for no color
edgecolor: mpl color spec, or None for default, or 'none' for no color
facecolor: mpl color spec, or None for default, or 'none' for no color
fc: mpl color spec, or None for default, or 'none' for no color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth: float or None for default
lod: [True | False]
lw: float or None for default
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- autoscale_view(self, tight=False, scalex=True, scaley=True)
- autoscale the view limits using the data limits. You can
selectively autoscale only a single axis, eg, the xaxis by
setting scaley to False. The autoscaling preserves any
axis direction reversal that has already been done.
- axhline(self, y=0, xmin=0, xmax=1, **kwargs)
- AXHLINE(y=0, xmin=0, xmax=1, **kwargs)
Axis Horizontal Line
Draw a horizontal line at y from xmin to xmax. With the default
values of xmin=0 and xmax=1, this line will always span the horizontal
extent of the axes, regardless of the xlim settings, even if you
change them, eg with the xlim command. That is, the horizontal extent
is in axes coords: 0=left, 0.5=middle, 1.0=right but the y location is
in data coordinates.
Return value is the Line2D instance. kwargs are the same as kwargs to
plot, and can be used to control the line properties. Eg
# draw a thick red hline at y=0 that spans the xrange
axhline(linewidth=4, color='r')
# draw a default hline at y=1 that spans the xrange
axhline(y=1)
# draw a default hline at y=.5 that spans the the middle half of
# the xrange
axhline(y=.5, xmin=0.25, xmax=0.75)
Valid kwargs are Line2D properties
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: unknown
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
color or c: any matplotlib color
contains: unknown
dash_capstyle: ['butt' | 'round' | 'projecting']
dash_joinstyle: ['miter' | 'round' | 'bevel']
dashes: sequence of on/off ink in points
data: (np.array xdata, np.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' | 'None' | ' ' | '' ]
linewidth or lw: float value in points
lod: [True | False]
marker: [ '+' | ',' | '.' | '1' | '2' | '3' | '4'
markeredgecolor or mec: any matplotlib color
markeredgewidth or mew: float value in points
markerfacecolor or mfc: any matplotlib color
markersize or ms: float
picker: unknown
pickradius: unknown
solid_capstyle: ['butt' | 'round' | 'projecting']
solid_joinstyle: ['miter' | 'round' | 'bevel']
transform: a matplotlib.transforms.Transform instance
visible: [True | False]
xdata: np.array
ydata: np.array
zorder: any number
- axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs)
- AXHSPAN(ymin, ymax, xmin=0, xmax=1, **kwargs)
Axis Horizontal Span. ycoords are in data units and x
coords are in axes (relative 0-1) units
Draw a horizontal span (regtangle) from ymin to ymax. With the
default values of xmin=0 and xmax=1, this always span the xrange,
regardless of the xlim settings, even if you change them, eg with the
xlim command. That is, the horizontal extent is in axes coords:
0=left, 0.5=middle, 1.0=right but the y location is in data
coordinates.
kwargs are the kwargs to Patch, eg
antialiased, aa
linewidth, lw
edgecolor, ec
facecolor, fc
the terms on the right are aliases
Return value is the patches.Polygon instance.
#draws a gray rectangle from y=0.25-0.75 that spans the horizontal
#extent of the axes
axhspan(0.25, 0.75, facecolor='0.5', alpha=0.5)
Valid kwargs are Polygon properties
aa: [True | False] or None for default
alpha: float
animated: [True | False]
antialiased: [True | False] or None for default
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
contains: unknown
ec: mpl color spec, or None for default, or 'none' for no color
edgecolor: mpl color spec, or None for default, or 'none' for no color
facecolor: mpl color spec, or None for default, or 'none' for no color
fc: mpl color spec, or None for default, or 'none' for no color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth: float or None for default
lod: [True | False]
lw: float or None for default
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- axis(self, *v, **kwargs)
- Convenience method for manipulating the x and y view limits
and the aspect ratio of the plot.
kwargs are passed on to set_xlim and set_ylim -- see their
docstrings for details
- axvline(self, x=0, ymin=0, ymax=1, **kwargs)
- AXVLINE(x=0, ymin=0, ymax=1, **kwargs)
Axis Vertical Line
Draw a vertical line at x from ymin to ymax. With the default values
of ymin=0 and ymax=1, this line will always span the vertical extent
of the axes, regardless of the xlim settings, even if you change them,
eg with the xlim command. That is, the vertical extent is in axes
coords: 0=bottom, 0.5=middle, 1.0=top but the x location is in data
coordinates.
Return value is the Line2D instance. kwargs are the same as
kwargs to plot, and can be used to control the line properties. Eg
# draw a thick red vline at x=0 that spans the yrange
l = axvline(linewidth=4, color='r')
# draw a default vline at x=1 that spans the yrange
l = axvline(x=1)
# draw a default vline at x=.5 that spans the the middle half of
# the yrange
axvline(x=.5, ymin=0.25, ymax=0.75)
Valid kwargs are Line2D properties
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: unknown
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
color or c: any matplotlib color
contains: unknown
dash_capstyle: ['butt' | 'round' | 'projecting']
dash_joinstyle: ['miter' | 'round' | 'bevel']
dashes: sequence of on/off ink in points
data: (np.array xdata, np.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' | 'None' | ' ' | '' ]
linewidth or lw: float value in points
lod: [True | False]
marker: [ '+' | ',' | '.' | '1' | '2' | '3' | '4'
markeredgecolor or mec: any matplotlib color
markeredgewidth or mew: float value in points
markerfacecolor or mfc: any matplotlib color
markersize or ms: float
picker: unknown
pickradius: unknown
solid_capstyle: ['butt' | 'round' | 'projecting']
solid_joinstyle: ['miter' | 'round' | 'bevel']
transform: a matplotlib.transforms.Transform instance
visible: [True | False]
xdata: np.array
ydata: np.array
zorder: any number
- axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs)
- AXVSPAN(xmin, xmax, ymin=0, ymax=1, **kwargs)
axvspan : Axis Vertical Span. xcoords are in data units and y coords
are in axes (relative 0-1) units
Draw a vertical span (regtangle) from xmin to xmax. With the default
values of ymin=0 and ymax=1, this always span the yrange, regardless
of the ylim settings, even if you change them, eg with the ylim
command. That is, the vertical extent is in axes coords: 0=bottom,
0.5=middle, 1.0=top but the y location is in data coordinates.
kwargs are the kwargs to Patch, eg
antialiased, aa
linewidth, lw
edgecolor, ec
facecolor, fc
the terms on the right are aliases
return value is the patches.Polygon instance.
# draw a vertical green translucent rectangle from x=1.25 to 1.55 that
# spans the yrange of the axes
axvspan(1.25, 1.55, facecolor='g', alpha=0.5)
Valid kwargs are Polygon properties
aa: [True | False] or None for default
alpha: float
animated: [True | False]
antialiased: [True | False] or None for default
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
contains: unknown
ec: mpl color spec, or None for default, or 'none' for no color
edgecolor: mpl color spec, or None for default, or 'none' for no color
facecolor: mpl color spec, or None for default, or 'none' for no color
fc: mpl color spec, or None for default, or 'none' for no color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth: float or None for default
lod: [True | False]
lw: float or None for default
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- bar(self, left, height, width=0.80000000000000004, bottom=None, color=None, edgecolor=None, linewidth=None, yerr=None, xerr=None, ecolor=None, capsize=3, align='edge', orientation='vertical', log=False, **kwargs)
- BAR(left, height, width=0.8, bottom=0,
color=None, edgecolor=None, linewidth=None,
yerr=None, xerr=None, ecolor=None, capsize=3,
align='edge', orientation='vertical', log=False)
Make a bar plot with rectangles bounded by
left, left+width, bottom, bottom+height
(left, right, bottom and top edges)
left, height, width, and bottom can be either scalars or sequences
Return value is a list of Rectangle patch instances
left - the x coordinates of the left sides of the bars
height - the heights of the bars
Optional arguments:
width - the widths of the bars
bottom - the y coordinates of the bottom edges of the bars
color - the colors of the bars
edgecolor - the colors of the bar edges
linewidth - width of bar edges; None means use default
linewidth; 0 means don't draw edges.
xerr and yerr, if not None, will be used to generate errorbars
on the bar chart
ecolor specifies the color of any errorbar
capsize (default 3) determines the length in points of the error
bar caps
align = 'edge' (default) | 'center'
orientation = 'vertical' | 'horizontal'
log = False | True - False (default) leaves the orientation
axis as-is; True sets it to log scale
For vertical bars, align='edge' aligns bars by their left edges in
left, while 'center' interprets these values as the x coordinates of
the bar centers. For horizontal bars, 'edge' aligns bars by their
bottom edges in bottom, while 'center' interprets these values as the
y coordinates of the bar centers.
The optional arguments color, edgecolor, linewidth, xerr, and yerr can
be either scalars or sequences of length equal to the number of bars.
This enables you to use bar as the basis for stacked bar charts, or
candlestick plots.
Optional kwargs:
aa: [True | False] or None for default
alpha: float
animated: [True | False]
antialiased: [True | False] or None for default
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
contains: unknown
ec: mpl color spec, or None for default, or 'none' for no color
edgecolor: mpl color spec, or None for default, or 'none' for no color
facecolor: mpl color spec, or None for default, or 'none' for no color
fc: mpl color spec, or None for default, or 'none' for no color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth: float or None for default
lod: [True | False]
lw: float or None for default
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- barh(self, bottom, width, height=0.80000000000000004, left=None, **kwargs)
- BARH(bottom, width, height=0.8, left=0, **kwargs)
Make a horizontal bar plot with rectangles bounded by
left, left+width, bottom, bottom+height
(left, right, bottom and top edges)
bottom, width, height, and left can be either scalars or sequences
Return value is a list of Rectangle patch instances
bottom - the vertical positions of the bottom edges of the bars
width - the lengths of the bars
Optional arguments:
height - the heights (thicknesses) of the bars
left - the x coordinates of the left edges of the bars
color - the colors of the bars
edgecolor - the colors of the bar edges
linewidth - width of bar edges; None means use default
linewidth; 0 means don't draw edges.
xerr and yerr, if not None, will be used to generate errorbars
on the bar chart
ecolor specifies the color of any errorbar
capsize (default 3) determines the length in points of the error
bar caps
align = 'edge' (default) | 'center'
log = False | True - False (default) leaves the horizontal
axis as-is; True sets it to log scale
Setting align='edge' aligns bars by their bottom edges in bottom,
while 'center' interprets these values as the y coordinates of the bar
centers.
The optional arguments color, edgecolor, linewidth, xerr, and yerr can
be either scalars or sequences of length equal to the number of bars.
This enables you to use barh as the basis for stacked bar charts, or
candlestick plots.
Optional kwargs:
aa: [True | False] or None for default
alpha: float
animated: [True | False]
antialiased: [True | False] or None for default
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
contains: unknown
ec: mpl color spec, or None for default, or 'none' for no color
edgecolor: mpl color spec, or None for default, or 'none' for no color
facecolor: mpl color spec, or None for default, or 'none' for no color
fc: mpl color spec, or None for default, or 'none' for no color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth: float or None for default
lod: [True | False]
lw: float or None for default
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5, positions=None, widths=None)
- boxplot(x, notch=0, sym='+', vert=1, whis=1.5,
positions=None, widths=None)
Make a box and whisker plot for each column of x or
each vector in sequence x.
The box extends from the lower to upper quartile values
of the data, with a line at the median. The whiskers
extend from the box to show the range of the data. Flier
points are those past the end of the whiskers.
notch = 0 (default) produces a rectangular box plot.
notch = 1 will produce a notched box plot
sym (default 'b+') is the default symbol for flier points.
Enter an empty string ('') if you don't want to show fliers.
vert = 1 (default) makes the boxes vertical.
vert = 0 makes horizontal boxes. This seems goofy, but
that's how Matlab did it.
whis (default 1.5) defines the length of the whiskers as
a function of the inner quartile range. They extend to the
most extreme data point within ( whis*(75%-25%) ) data range.
positions (default 1,2,...,n) sets the horizontal positions of
the boxes. The ticks and limits are automatically set to match
the positions.
widths is either a scalar or a vector and sets the width of
each box. The default is 0.5, or 0.15*(distance between extreme
positions) if that is smaller.
x is an array or a sequence of vectors.
Returns a list of the lines added.
- broken_barh(self, xranges, yrange, **kwargs)
- A collection of horizontal bars spanning yrange with a sequence of
xranges
xranges : sequence of (xmin, xwidth)
yrange : (ymin, ywidth)
kwargs are collections.BrokenBarHCollection properties
alpha: float
animated: [True | False]
antialiased: Boolean or sequence of booleans
antialiaseds: Boolean or sequence of booleans
array: unknown
axes: an axes instance
clim: a length 2 sequence of floats
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
dashes: ['solid' | 'dashed', 'dashdot', 'dotted' | (offset, on-off-dash-seq) ]
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: matplotlib color arg or sequence of rgba tuples
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: matplotlib color arg or sequence of rgba tuples
figure: a matplotlib.figure.Figure instance
label: any string
linestyle: ['solid' | 'dashed', 'dashdot', 'dotted' | (offset, on-off-dash-seq) ]
linestyles: ['solid' | 'dashed', 'dashdot', 'dotted' | (offset, on-off-dash-seq) ]
linewidth: float or sequence of floats
linewidths: float or sequence of floats
lod: [True | False]
lw: float or sequence of floats
norm: unknown
picker: [None|float|boolean|callable]
pickradius: unknown
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
these can either be a single argument, ie facecolors='black'
or a sequence of arguments for the various bars, ie
facecolors='black', 'red', 'green'
- can_zoom(self)
- Return True if this axes support the zoom box
- cla(self)
- Clear the current axes
- clabel(self, CS, *args, **kwargs)
- clabel(CS, **kwargs) - add labels to line contours in CS,
where CS is a ContourSet object returned by contour.
clabel(CS, V, **kwargs) - only label contours listed in V
keyword arguments:
* fontsize = None: as described in http://matplotlib.sf.net/fonts.html
* colors = None:
- a tuple of matplotlib color args (string, float, rgb, etc),
different labels will be plotted in different colors in the order
specified
- one string color, e.g. colors = 'r' or colors = 'red', all labels
will be plotted in this color
- if colors == None, the color of each label matches the color
of the corresponding contour
* inline = True: controls whether the underlying contour is removed
(inline = True) or not (False)
* fmt = '%1.3f': a format string for the label
- clear(self)
- clear the axes
- cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x13178c0>, window=<function window_hanning at 0x1310848>, noverlap=0, **kwargs)
- COHERE(x, y, NFFT=256, Fs=2, Fc=0, detrend = mlab.detrend_none,
window = mlab.window_hanning, noverlap=0, **kwargs)
cohere the coherence between x and y. Coherence is the normalized
cross spectral density
Cxy = |Pxy|^2/(Pxx*Pyy)
The return value is (Cxy, f), where f are the frequencies of the
coherence vector.
See the PSD help for a description of the optional parameters.
kwargs are applied to the lines
Returns the tuple Cxy, freqs
Refs: Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
kwargs control the Line2D properties of the coherence plot:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: unknown
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
color or c: any matplotlib color
contains: unknown
dash_capstyle: ['butt' | 'round' | 'projecting']
dash_joinstyle: ['miter' | 'round' | 'bevel']
dashes: sequence of on/off ink in points
data: (np.array xdata, np.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' | 'None' | ' ' | '' ]
linewidth or lw: float value in points
lod: [True | False]
marker: [ '+' | ',' | '.' | '1' | '2' | '3' | '4'
markeredgecolor or mec: any matplotlib color
markeredgewidth or mew: float value in points
markerfacecolor or mfc: any matplotlib color
markersize or ms: float
picker: unknown
pickradius: unknown
solid_capstyle: ['butt' | 'round' | 'projecting']
solid_joinstyle: ['miter' | 'round' | 'bevel']
transform: a matplotlib.transforms.Transform instance
visible: [True | False]
xdata: np.array
ydata: np.array
zorder: any number
- connect(self, s, func)
- Register observers to be notified when certain events occur. Register
with callback functions with the following signatures. The function
has the following signature
func(ax) # where ax is the instance making the callback.
The following events can be connected to:
'xlim_changed','ylim_changed'
The connection id is is returned - you can use this with
disconnect to disconnect from the axes event
- contains(self, mouseevent)
- Test whether the mouse event occured in the axes.
Returns T/F, {}
- contour(self, *args, **kwargs)
- contour and contourf draw contour lines and filled contours,
respectively. Except as noted, function signatures and return
values are the same for both versions.
contourf differs from the Matlab (TM) version in that it does not
draw the polygon edges, because the contouring engine yields
simply connected regions with branch cuts. To draw the edges,
add line contours with calls to contour.
Function signatures
contour(Z) - make a contour plot of an array Z. The level
values are chosen automatically.
contour(X,Y,Z) - X,Y specify the (x,y) coordinates of the surface
contour(Z,N) and contour(X,Y,Z,N) - contour N automatically-chosen
levels.
contour(Z,V) and contour(X,Y,Z,V) - draw len(V) contour lines,
at the values specified in sequence V
contourf(..., V) - fill the (len(V)-1) regions between the
values in V
contour(Z, **kwargs) - Use keyword args to control colors, linewidth,
origin, cmap ... see below
X, Y, and Z must be arrays with the same dimensions.
Z may be a masked array, but filled contouring may not handle
internal masked regions correctly.
C = contour(...) returns a ContourSet object.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* colors = None; or one of the following:
- a tuple of matplotlib color args (string, float, rgb, etc),
different levels will be plotted in different colors in the order
specified
- one string color, e.g. colors = 'r' or colors = 'red', all levels
will be plotted in this color
- if colors == None, the colormap specified by cmap will be used
* alpha=1.0 : the alpha blending value
* cmap = None: a cm Colormap instance from matplotlib.cm.
- if cmap == None and colors == None, a default Colormap is used.
* norm = None: a matplotlib.colors.Normalize instance for
scaling data values to colors.
- if norm == None, and colors == None, the default
linear scaling is used.
* origin = None: 'upper'|'lower'|'image'|None.
If 'image', the rc value for image.origin will be used.
If None (default), the first value of Z will correspond
to the lower left corner, location (0,0).
This keyword is active only if contourf is called with
one or two arguments, that is, without explicitly
specifying X and Y.
* extent = None: (x0,x1,y0,y1); also active only if X and Y
are not specified. If origin is not None, then extent is
interpreted as in imshow: it gives the outer pixel boundaries.
In this case, the position of Z[0,0] is the center of the
pixel, not a corner.
If origin is None, then (x0,y0) is the position of Z[0,0],
and (x1,y1) is the position of Z[-1,-1].
* locator = None: an instance of a ticker.Locator subclass;
default is MaxNLocator. It is used to determine the
contour levels if they are not given explicitly via the
V argument.
* extend = 'neither', 'both', 'min', 'max'
Unless this is 'neither' (default), contour levels are
automatically added to one or both ends of the range so that
all data are included. These added ranges are then
mapped to the special colormap values which default to
the ends of the colormap range, but can be set via
Colormap.set_under() and Colormap.set_over() methods.
****************
contour only:
* linewidths = None: or one of these:
- a number - all levels will be plotted with this linewidth,
e.g. linewidths = 0.6
- a tuple of numbers, e.g. linewidths = (0.4, 0.8, 1.2) different
levels will be plotted with different linewidths in the order
specified
- if linewidths == None, the default width in lines.linewidth in
matplotlibrc is used
contourf only:
* antialiased = True (default) or False
* nchunk = 0 (default) for no subdivision of the domain;
specify a positive integer to divide the domain into
subdomains of roughly nchunk by nchunk points. This may
never actually be advantageous, so this option may be
removed. Chunking introduces artifacts at the chunk
boundaries unless antialiased = False
- contourf(self, *args, **kwargs)
- contour and contourf draw contour lines and filled contours,
respectively. Except as noted, function signatures and return
values are the same for both versions.
contourf differs from the Matlab (TM) version in that it does not
draw the polygon edges, because the contouring engine yields
simply connected regions with branch cuts. To draw the edges,
add line contours with calls to contour.
Function signatures
contour(Z) - make a contour plot of an array Z. The level
values are chosen automatically.
contour(X,Y,Z) - X,Y specify the (x,y) coordinates of the surface
contour(Z,N) and contour(X,Y,Z,N) - contour N automatically-chosen
levels.
contour(Z,V) and contour(X,Y,Z,V) - draw len(V) contour lines,
at the values specified in sequence V
contourf(..., V) - fill the (len(V)-1) regions between the
values in V
contour(Z, **kwargs) - Use keyword args to control colors, linewidth,
origin, cmap ... see below
X, Y, and Z must be arrays with the same dimensions.
Z may be a masked array, but filled contouring may not handle
internal masked regions correctly.
C = contour(...) returns a ContourSet object.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* colors = None; or one of the following:
- a tuple of matplotlib color args (string, float, rgb, etc),
different levels will be plotted in different colors in the order
specified
- one string color, e.g. colors = 'r' or colors = 'red', all levels
will be plotted in this color
- if colors == None, the colormap specified by cmap will be used
* alpha=1.0 : the alpha blending value
* cmap = None: a cm Colormap instance from matplotlib.cm.
- if cmap == None and colors == None, a default Colormap is used.
* norm = None: a matplotlib.colors.Normalize instance for
scaling data values to colors.
- if norm == None, and colors == None, the default
linear scaling is used.
* origin = None: 'upper'|'lower'|'image'|None.
If 'image', the rc value for image.origin will be used.
If None (default), the first value of Z will correspond
to the lower left corner, location (0,0).
This keyword is active only if contourf is called with
one or two arguments, that is, without explicitly
specifying X and Y.
* extent = None: (x0,x1,y0,y1); also active only if X and Y
are not specified. If origin is not None, then extent is
interpreted as in imshow: it gives the outer pixel boundaries.
In this case, the position of Z[0,0] is the center of the
pixel, not a corner.
If origin is None, then (x0,y0) is the position of Z[0,0],
and (x1,y1) is the position of Z[-1,-1].
* locator = None: an instance of a ticker.Locator subclass;
default is MaxNLocator. It is used to determine the
contour levels if they are not given explicitly via the
V argument.
* extend = 'neither', 'both', 'min', 'max'
Unless this is 'neither' (default), contour levels are
automatically added to one or both ends of the range so that
all data are included. These added ranges are then
mapped to the special colormap values which default to
the ends of the colormap range, but can be set via
Colormap.set_under() and Colormap.set_over() methods.
****************
contour only:
* linewidths = None: or one of these:
- a number - all levels will be plotted with this linewidth,
e.g. linewidths = 0.6
- a tuple of numbers, e.g. linewidths = (0.4, 0.8, 1.2) different
levels will be plotted with different linewidths in the order
specified
- if linewidths == None, the default width in lines.linewidth in
matplotlibrc is used
contourf only:
* antialiased = True (default) or False
* nchunk = 0 (default) for no subdivision of the domain;
specify a positive integer to divide the domain into
subdomains of roughly nchunk by nchunk points. This may
never actually be advantageous, so this option may be
removed. Chunking introduces artifacts at the chunk
boundaries unless antialiased = False
- csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x13178c0>, window=<function window_hanning at 0x1310848>, noverlap=0, **kwargs)
- CSD(x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=window_hanning, noverlap=0, **kwargs)
The cross spectral density Pxy by Welches average periodogram method.
The vectors x and y are divided into NFFT length segments. Each
segment is detrended by function detrend and windowed by function
window. The product of the direct FFTs of x and y are averaged over
each segment to compute Pxy, with a scaling to correct for power loss
due to windowing.
See the PSD help for a description of the optional parameters.
Returns the tuple Pxy, freqs. Pxy is the cross spectrum (complex
valued), and 10*np.log10(|Pxy|) is plotted
Refs:
Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
kwargs control the Line2D properties:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: unknown
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
color or c: any matplotlib color
contains: unknown
dash_capstyle: ['butt' | 'round' | 'projecting']
dash_joinstyle: ['miter' | 'round' | 'bevel']
dashes: sequence of on/off ink in points
data: (np.array xdata, np.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' | 'None' | ' ' | '' ]
linewidth or lw: float value in points
lod: [True | False]
marker: [ '+' | ',' | '.' | '1' | '2' | '3' | '4'
markeredgecolor or mec: any matplotlib color
markeredgewidth or mew: float value in points
markerfacecolor or mfc: any matplotlib color
markersize or ms: float
picker: unknown
pickradius: unknown
solid_capstyle: ['butt' | 'round' | 'projecting']
solid_joinstyle: ['miter' | 'round' | 'bevel']
transform: a matplotlib.transforms.Transform instance
visible: [True | False]
xdata: np.array
ydata: np.array
zorder: any number
- disconnect(self, cid)
- disconnect from the Axes event.
- drag_pan(self, button, key, x, y)
- Called when the mouse moves during a pan operation.
button is the mouse button number:
1: LEFT
2: MIDDLE
3: RIGHT
key is a "shift" key
x, y are the mouse coordinates in display coords.
Intended to be overridden by new projection types.
- draw(self, renderer=None, inframe=False)
- Draw everything (plot lines, axes, labels)
- draw_artist(self, a)
- This method can only be used after an initial draw which
caches the renderer. It is used to efficiently update Axes
data (axis ticks, labels, etc are not updated)
- end_pan(self)
- Called when a pan operation completes (when the mouse button
is up.)
Intended to be overridden by new projection types.
- errorbar(self, x, y, yerr=None, xerr=None, fmt='-', ecolor=None, elinewidth=None, capsize=3, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, **kwargs)
- ERRORBAR(x, y, yerr=None, xerr=None,
fmt='b-', ecolor=None, elinewidth=None, capsize=3,
barsabove=False, lolims=False, uplims=False,
xlolims=False, xuplims=False)
Plot x versus y with error deltas in yerr and xerr.
Vertical errorbars are plotted if yerr is not None
Horizontal errorbars are plotted if xerr is not None
xerr and yerr may be any of:
a rank-0, Nx1 Numpy array - symmetric errorbars +/- value
an N-element list or tuple - symmetric errorbars +/- value
a rank-1, Nx2 Numpy array - asymmetric errorbars -column1/+column2
Alternatively, x, y, xerr, and yerr can all be scalars, which
plots a single error bar at x, y.
fmt is the plot format symbol for y. if fmt is None, just
plot the errorbars with no line symbols. This can be useful
for creating a bar plot with errorbars
ecolor is a matplotlib color arg which gives the color the
errorbar lines; if None, use the marker color.
elinewidth is the linewidth of the errorbar lines;
if None, use the linewidth.
capsize is the size of the error bar caps in points
barsabove, if True, will plot the errorbars above the plot symbols
- default is below
lolims, uplims, xlolims, xuplims: These arguments can be used
to indicate that a value gives only upper/lower limits. In
that case a caret symbol is used to indicate this. lims-arguments
may be of the same type as xerr and yerr.
kwargs are passed on to the plot command for the markers.
So you can add additional key=value pairs to control the
errorbar markers. For example, this code makes big red
squares with thick green edges
>>> x,y,yerr = rand(3,10)
>>> errorbar(x, y, yerr, marker='s',
mfc='red', mec='green', ms=20, mew=4)
mfc, mec, ms and mew are aliases for the longer property
names, markerfacecolor, markeredgecolor, markersize and
markeredgewith.
valid kwargs for the marker properties are
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: unknown
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
color or c: any matplotlib color
contains: unknown
dash_capstyle: ['butt' | 'round' | 'projecting']
dash_joinstyle: ['miter' | 'round' | 'bevel']
dashes: sequence of on/off ink in points
data: (np.array xdata, np.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' | 'None' | ' ' | '' ]
linewidth or lw: float value in points
lod: [True | False]
marker: [ '+' | ',' | '.' | '1' | '2' | '3' | '4'
markeredgecolor or mec: any matplotlib color
markeredgewidth or mew: float value in points
markerfacecolor or mfc: any matplotlib color
markersize or ms: float
picker: unknown
pickradius: unknown
solid_capstyle: ['butt' | 'round' | 'projecting']
solid_joinstyle: ['miter' | 'round' | 'bevel']
transform: a matplotlib.transforms.Transform instance
visible: [True | False]
xdata: np.array
ydata: np.array
zorder: any number
Return value is a length 3 tuple. The first element is the
Line2D instance for the y symbol lines. The second element is
a list of error bar cap lines, the third element is a list of
line collections for the horizontal and vertical error ranges
- fill(self, *args, **kwargs)
- FILL(*args, **kwargs)
plot filled polygons. *args is a variable length argument, allowing
for multiple x,y pairs with an optional color format string; see plot
for details on the argument parsing. For example, all of the
following are legal, assuming ax is an Axes instance:
ax.fill(x,y) # plot polygon with vertices at x,y
ax.fill(x,y, 'b' ) # plot polygon with vertices at x,y in blue
An arbitrary number of x, y, color groups can be specified, as in
ax.fill(x1, y1, 'g', x2, y2, 'r')
Return value is a list of patches that were added
The same color strings that plot supports are supported by the fill
format string.
If you would like to fill below a curve, eg shade a region
between 0 and y along x, use mlab.poly_between, eg
xs, ys = poly_between(x, 0, y)
axes.fill(xs, ys, facecolor='red', alpha=0.5)
See examples/fill_between.py for more examples.
kwargs control the Polygon properties:
aa: [True | False] or None for default
alpha: float
animated: [True | False]
antialiased: [True | False] or None for default
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
contains: unknown
ec: mpl color spec, or None for default, or 'none' for no color
edgecolor: mpl color spec, or None for default, or 'none' for no color
facecolor: mpl color spec, or None for default, or 'none' for no color
fc: mpl color spec, or None for default, or 'none' for no color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth: float or None for default
lod: [True | False]
lw: float or None for default
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- format_coord(self, x, y)
- return a format string formatting the x, y coord
- format_xdata(self, x)
- Return x string formatted. This function will use the attribute
self.fmt_xdata if it is callable, else will fall back on the xaxis
major formatter
- format_ydata(self, y)
- Return y string formatted. This function will use the attribute
self.fmt_ydata if it is callable, else will fall back on the yaxis
major formatter
- get_adjustable(self)
- get_anchor(self)
- get_aspect(self)
- get_autoscale_on(self)
- Get whether autoscaling is applied on plot commands
- get_axes_patch(self)
- Returns the patch used to draw the background of the axes. It
is also used as the clipping path for any data elements on the
axes.
In the standard axes, this is a rectangle, but in other
projections it may not be.
Intended to be overridden by new projection types.
- get_axis_bgcolor(self)
- Return the axis background color
- get_axisbelow(self)
- Get whether axist below is true or not
- get_child_artists(self)
- Return a list of artists the axes contains. Deprecated
- get_children(self)
- return a list of child artists
- get_cursor_props(self)
- return the cursor props as a linewidth, color tuple where
linewidth is a float and color is an RGBA tuple
- get_data_ratio(self)
- Returns the aspect ratio of the raw data.
This method is intended to be overridden by new projection
types.
- get_frame(self)
- Return the axes Rectangle frame
- get_frame_on(self)
- Get whether the axes rectangle patch is drawn
- get_images(self)
- return a list of Axes images contained by the Axes
- get_legend(self)
- Return the legend.Legend instance, or None if no legend is defined
- get_lines(self)
- Return a list of lines contained by the Axes
- get_navigate(self)
- Get whether the axes responds to navigation commands
- get_navigate_mode(self)
- Get the navigation toolbar button status: 'PAN', 'ZOOM', or None
- get_position(self, original=False)
- Return the a copy of the axes rectangle as a Bbox
- get_renderer_cache(self)
- get_title(self)
- Get the title text string.
- get_window_extent(self, *args, **kwargs)
- get the axes bounding box in display space; args and kwargs are empty
- get_xaxis(self)
- Return the XAxis instance
- get_xaxis_text1_transform(self, pad_points)
- Get the transformation used for drawing x-axis labels, which
will add the given amount of padding (in points) between the
axes and the label. The x-direction is in data coordinates
and the y-direction is in axis coordinates. Returns a 3-tuple
of the form:
(transform, valign, halign)
where valign and halign are requested alignments for the text.
This transformation is primarily used by the Axis class, and
is meant to be overridden by new kinds of projections that may
need to place axis elements in different locations.
- get_xaxis_text2_transform(self, pad_points)
- Get the transformation used for drawing the secondary x-axis
labels, which will add the given amount of padding (in points)
between the axes and the label. The x-direction is in data
coordinates and the y-direction is in axis coordinates.
Returns a 3-tuple of the form:
(transform, valign, halign)
where valign and halign are requested alignments for the text.
This transformation is primarily used by the Axis class, and
is meant to be overridden by new kinds of projections that may
need to place axis elements in different locations.
- get_xaxis_transform(self)
- Get the transformation used for drawing x-axis labels, ticks
and gridlines. The x-direction is in data coordinates and the
y-direction is in axis coordinates.
This transformation is primarily used by the Axis class, and
is meant to be overridden by new kinds of projections that may
need to place axis elements in different locations.
- get_xbound(self)
- Returns the x-axis numerical bounds in the form of lowerBound < upperBound
- get_xgridlines(self)
- Get the x grid lines as a list of Line2D instances
- get_xlabel(self)
- Get the xlabel text string.
- get_xlim(self)
- Get the x-axis range [xmin, xmax]
- get_xmajorticklabels(self)
- Get the xtick labels as a list of Text instances
- get_xminorticklabels(self)
- Get the xtick labels as a list of Text instances
- get_xscale(self)
- get_xticklabels(self, minor=False)
- Get the xtick labels as a list of Text instances
- get_xticklines(self)
- Get the xtick lines as a list of Line2D instances
- get_xticks(self, minor=False)
- Return the x ticks as a list of locations
- get_yaxis(self)
- Return the YAxis instance
- get_yaxis_text1_transform(self, pad_points)
- Get the transformation used for drawing y-axis labels, which
will add the given amount of padding (in points) between the
axes and the label. The x-direction is in axis coordinates
and the y-direction is in data coordinates. Returns a 3-tuple
of the form:
(transform, valign, halign)
where valign and halign are requested alignments for the text.
This transformation is primarily used by the Axis class, and
is meant to be overridden by new kinds of projections that may
need to place axis elements in different locations.
- get_yaxis_text2_transform(self, pad_points)
- Get the transformation used for drawing the secondary y-axis
labels, which will add the given amount of padding (in points)
between the axes and the label. The x-direction is in axis
coordinates and the y-direction is in data coordinates.
Returns a 3-tuple of the form:
(transform, valign, halign)
where valign and halign are requested alignments for the text.
This transformation is primarily used by the Axis class, and
is meant to be overridden by new kinds of projections that may
need to place axis elements in different locations.
- get_yaxis_transform(self)
- Get the transformation used for drawing y-axis labels, ticks
and gridlines. The x-direction is in axis coordinates and the
y-direction is in data coordinates.
This transformation is primarily used by the Axis class, and
is meant to be overridden by new kinds of projections that may
need to place axis elements in different locations.
- get_ybound(self)
- Returns the y-axis numerical bounds in the form of lowerBound < upperBound
- get_ygridlines(self)
- Get the y grid lines as a list of Line2D instances
- get_ylabel(self)
- Get the ylabel text string.
- get_ylim(self)
- Get the y-axis range [xmin, xmax]
- get_ymajorticklabels(self)
- Get the xtick labels as a list of Text instances
- get_yminorticklabels(self)
- Get the xtick labels as a list of Text instances
- get_yscale(self)
- get_yticklabels(self, minor=False)
- Get the xtick labels as a list of Text instances
- get_yticklines(self)
- Get the ytick lines as a list of Line2D instances
- get_yticks(self, minor=False)
- Return the y ticks as a list of locations
- grid(self, b=None, **kwargs)
- GRID(self, b=None, **kwargs)
Set the axes grids on or off; b is a boolean
if b is None and len(kwargs)==0, toggle the grid state. if
kwargs are supplied, it is assumed that you want a grid and b
is thus set to True
kawrgs are used to set the grid line properties, eg
ax.grid(color='r', linestyle='-', linewidth=2)
Valid Line2D kwargs are
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: unknown
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: a Path instance and a Transform instance, a Patch
color or c: any matplotlib color
contains: unknown
dash_capstyle: ['butt' | 'round' | 'projecting']
dash_joinstyle: ['miter' | 'round' | 'bevel']
dashes: sequence of on/off ink in points
data: (np.array xdata, np.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' | 'None' | ' ' | '' ]
linewidth or lw: float value in points
lod: [True | False]
marker: [ '+' | ',' | '.' | '1' | '2' | '3' | '4'
markeredgecolor or mec: any matplotlib color
markeredgewidth or mew: float value in points
markerfacecolor or mfc: any matplotlib color
markersize or ms: float
picker: unknown
pickradius: unknown
solid_capstyle: ['butt' | 'round' | 'projecting']
solid_joinstyle: ['miter' | 'round' | 'bevel']
transform: 
| |