| |
- matplotlib.artist.Artist
-
- Axes
-
- PolarAxes
- SubplotBase
-
- PolarSubplot(SubplotBase, PolarAxes)
- Subplot(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 |
|
Methods defined here:
- __init__(self, fig, rect, axisbg=None, frameon=True, sharex=None, sharey=None, label='', **kwargs)
- Build an Axes instance in Figure with
rect=[left, bottom, width,height in Figure coords
adjustable: ['box' | 'datalim']
alpha: the alpha transparency
anchor: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
aspect: ['auto' | 'equal' | aspect_ratio]
autoscale_on: boolean - whether or not to autoscale the viewlim
axis_bgcolor: any matplotlib color - see help(colors)
axisbelow: draw the grids and ticks below the other artists
cursor_props: a (float, color) tuple
figure: a Figure instance
frame_on: a boolean - draw the axes frame
label: the axes label
navigate: True|False
navigate_mode: the navigation toolbar button status: 'PAN', 'ZOOM', or None
position: [left, bottom, width,height in Figure coords
sharex : an Axes instance to share the x-axis with
sharey : an Axes instance to share the y-axis with
title: the title string
visible: a boolean - whether the axes is visible
xlabel: the xlabel
xlim: (xmin, xmax) view limits
xscale: ['log' | 'linear' ]
xticklabels: sequence of strings
xticks: sequence of floats
ylabel: the ylabel strings
ylim: (ymin, ymax) view limits
yscale: ['log' | 'linear']
yticklabels: sequence of strings
yticks: sequence of floats
- __str__(self)
- acorr(self, x, **kwargs)
- 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=False)
- 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)
- 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
- 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.
'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: an agg.path_storage instance
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, data_ratio=None)
- Use self._aspect and self._adjustable to modify the
axes box or the view limits.
The data_ratio kwarg is set to 1 for polar axes. It is
used only when _adjustable is 'box'.
- 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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
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'
- 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 0x868817c>, window=<function window_hanning at 0x868802c>, 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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 0x868817c>, window=<function window_hanning at 0x868802c>, 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*npy.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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- disconnect(self, cid)
- disconnect from the Axes event.
- 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)
- errorbar(self, x, y, yerr=None, xerr=None, fmt='-', ecolor=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, 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.
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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_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_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 axes rectangle left, bottom, width, height
- get_renderer_cache(self)
- 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_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_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)
- return the xaxis scale string: log or linear
- 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_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_ylim(self)
- Get the y axis range [ymin, ymax]
- 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)
- return the yaxis scale string: log or linear
- 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- has_data(self)
- Return true if any artists have been added to axes.
This should not be used to determine whether the dataLim
need to be updated, and may not actually be useful for
anything.
- hist(self, x, bins=10, normed=0, bottom=None, align='edge', orientation='vertical', width=None, log=False, **kwargs)
- HIST(x, bins=10, normed=0, bottom=None,
align='edge', orientation='vertical', width=None,
log=False, **kwargs)
Compute the histogram of x. bins is either an integer number of
bins or a sequence giving the bins. x are the data to be binned.
The return values is (n, bins, patches)
If normed is true, the first element of the return tuple will
be the counts normalized to form a probability density, ie,
n/(len(x)*dbin). In a probability density, the integral of
the histogram should be one (we assume equally spaced bins);
you can verify that with
# trapezoidal integration of the probability density function
pdf, bins, patches = ax.hist(...)
print npy.trapz(pdf, bins)
align = 'edge' | 'center'. Interprets bins either as edge
or center values
orientation = 'horizontal' | 'vertical'. If horizontal, barh
will be used and the "bottom" kwarg will be the left edges.
width: the width of the bars. If None, automatically compute
the width.
log: if True, the histogram axis will be set to a log scale
kwargs are used to update the properties of the
hist Rectangles:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- hlines(self, y, xmin, xmax, colors='k', linestyle='solid', label='', **kwargs)
- HLINES(y, xmin, xmax, colors='k', linestyle='solid', **kwargs)
plot horizontal lines at each y from xmin to xmax. xmin or xmax can
be scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the widths of the lines are
determined by xmin and xmax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the LineCollection that was added
- hold(self, b=None)
- HOLD(b=None)
Set the hold state. If hold is None (default), toggle the
hold state. Else set the hold state to boolean value b.
Eg
hold() # toggle hold
hold(True) # hold is on
hold(False) # hold is off
When hold is True, subsequent plot commands will be added to
the current axes. When hold is False, the current axes and
figure will be cleared on the next plot command
- imshow(self, X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=1.0, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, **kwargs)
- IMSHOW(X, cmap=None, norm=None, aspect=None, interpolation=None,
alpha=1.0, vmin=None, vmax=None, origin=None, extent=None)
IMSHOW(X) - plot image X to current axes, resampling to scale to axes
size (X may be numpy array or PIL image)
IMSHOW(X, **kwargs) - Use keyword args to control image scaling,
colormapping etc. See below for details
Display the image in X to current axes. X may be a float array, a
uint8 array or a PIL image. If X is an array, X can have the following
shapes:
MxN : luminance (grayscale, float array only)
MxNx3 : RGB (float or uint8 array)
MxNx4 : RGBA (float or uint8 array)
The value for each component of MxNx3 and MxNx4 float arrays should be
in the range 0.0 to 1.0; MxN float arrays may be normalised.
A image.AxesImage instance is returned
The following kwargs are allowed:
* cmap is a cm colormap instance, eg cm.jet. If None, default to rc
image.cmap value (Ignored when X has RGB(A) information)
* aspect is one of: auto, equal, or a number. If None, default to rc
image.aspect value
* interpolation is one of:
'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
'lanczos', 'blackman'
if interpolation is None, default to rc
image.interpolation. See also th the filternorm and
filterrad parameters
* norm is a mcolors.Normalize instance; default is
normalization(). This scales luminance -> 0-1 (only used for an
MxN float array).
* vmin and vmax are used to scale a luminance image to 0-1. If
either is None, the min and max of the luminance values will be
used. Note if you pass a norm instance, the settings for vmin and
vmax will be ignored.
* alpha = 1.0 : the alpha blending value
* origin is 'upper' or 'lower', to place the [0,0]
index of the array in the upper left or lower left corner of
the axes. If None, default to rc image.origin
* extent is (left, right, bottom, top) data values of the
axes. The default assigns zero-based row, column indices
to the x, y centers of the pixels.
* shape is for raw buffer images
* filternorm is a parameter for the antigrain image resize
filter. From the antigrain documentation, if normalize=1,
the filter normalizes integer values and corrects the
rounding errors. It doesn't do anything with the source
floating point values, it corrects only integers according
to the rule of 1.0 which means that any sum of pixel
weights must be equal to 1.0. So, the filter function
must produce a graph of the proper shape.
* filterrad: the filter radius for filters that have a radius
parameter, ie when interpolation is one of: 'sinc',
'lanczos' or 'blackman'
Additional kwargs are martist properties
- in_axes(self, xwin, ywin)
- return True is the point xwin, ywin (display coords) are in the Axes
- invert_xaxis(self)
- Invert the x-axis.
- invert_yaxis(self)
- Invert the y-axis.
- ishold(self)
- return the HOLD status of the axes
- legend(self, *args, **kwargs)
- LEGEND(*args, **kwargs)
Place a legend on the current axes at location loc. Labels are a
sequence of strings and loc can be a string or an integer specifying
the legend location
USAGE:
Make a legend with existing lines
>>> legend()
legend by itself will try and build a legend using the label
property of the lines/patches/collections. You can set the label of
a line by doing plot(x, y, label='my data') or line.set_label('my
data'). If label is set to '_nolegend_', the item will not be shown
in legend.
# automatically generate the legend from labels
legend( ('label1', 'label2', 'label3') )
# Make a legend for a list of lines and labels
legend( (line1, line2, line3), ('label1', 'label2', 'label3') )
# Make a legend at a given location, using a location argument
# legend( LABELS, LOC ) or
# legend( LINES, LABELS, LOC )
legend( ('label1', 'label2', 'label3'), loc='upper left')
legend( (line1, line2, line3), ('label1', 'label2', 'label3'), loc=2)
The location codes are
'best' : 0,
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right' : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center' : 10,
If none of these are suitable, loc can be a 2-tuple giving x,y
in axes coords, ie,
loc = 0, 1 is left top
loc = 0.5, 0.5 is center, center
and so on. The following kwargs are supported:
isaxes=True # whether this is an axes legend
numpoints = 4 # the number of points in the legend line
prop = FontProperties(size='smaller') # the font property
pad = 0.2 # the fractional whitespace inside the legend border
markerscale = 0.6 # the relative size of legend markers vs. original
shadow # if True, draw a shadow behind legend
labelsep = 0.005 # the vertical space between the legend entries
handlelen = 0.05 # the length of the legend lines
handletextsep = 0.02 # the space between the legend line and legend text
axespad = 0.02 # the border between the axes and legend edge
- loglog(self, *args, **kwargs)
- LOGLOG(*args, **kwargs)
Make a loglog plot with log scaling on the a and y axis. The args
to semilog x are the same as the args to plot. See help plot for
more info.
Optional keyword args supported are any of the kwargs
supported by plot or set_xscale or set_yscale. Notable, for
log scaling:
* basex: base of the x logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
* basey: base of the y logarithm
* subsy: the location of the minor yticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- matshow(self, Z, **kwargs)
- Plot a matrix as an image.
The matrix will be shown the way it would be printed,
with the first row at the top. Row and column numbering
is zero-based.
Argument:
Z anything that can be interpreted as a 2-D array
kwargs: all are passed to imshow. matshow sets defaults
for extent, origin, interpolation, and aspect; use care
in overriding the extent and origin kwargs, because they
interact. (Also, if you want to change them, you probably
should be using imshow directly in your own version of
matshow.)
Returns: an image.AxesImage instance
- pcolor(self, *args, **kwargs)
- pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the array of color values
X and Y, if given, specify the (x,y) coordinates of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). Ideally the dimensions of X and Y
should be one greater than those of C; if the dimensions are the
same, then the last row and column of C will be ignored.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
If either or both of X and Y are 1-D arrays or column vectors,
they will be expanded as needed into the appropriate 2-D arrays,
making a rectangular grid.
X,Y and C may be masked arrays. If either C[i,j], or one
of the vertices surrounding C[i,j] (X or Y at [i,j],[i+1,j],
[i,j+1],[i=1,j+1]) is masked, nothing is plotted.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
edgecolors can also be None to specify the rcParams
default, or any mpl color or sequence of colors.
* alpha=1.0 : the alpha blending value
Return value is a mcoll.PatchCollection
object
Grid Orientation
The orientation follows the Matlab(TM) convention: an
array C with shape (nrows, ncolumns) is plotted with
the column number as X and the row number as Y, increasing
up; hence it is plotted the way the array would be printed,
except that the Y axis is reversed. That is, C is taken
as C(y,x).
Similarly for meshgrid:
x = npy.arange(5)
y = npy.arange(3)
X, Y = meshgrid(x,y)
is equivalent to
X = array([[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]])
Y = array([[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[2, 2, 2, 2, 2]])
so if you have
C = rand( len(x), len(y))
then you need
pcolor(X, Y, C.T)
or
pcolor(C.T)
Dimensions
Matlab pcolor always discards
the last row and column of C, but matplotlib displays
the last row and column if X and Y are not specified, or
if X and Y have one more row and column than C.
kwargs can be used to control the PolyCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pcolorfast(self, *args, **kwargs)
- Experimental; this is a version of pcolor that
does not draw lines, that provides the fastest
possible rendering with the Agg backend, and that
can handle any quadrilateral grid.
pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(xr, yr, C, **kwargs)
pcolor(x, y, C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the 2D array of color values corresponding to quadrilateral
cells. Let (nr, nc) be its shape. C may be a masked array.
pcolor(C, **kwargs) is equivalent to
pcolor([0,nc], [0,nr], C, **kwargs)
xr, yr specify the ranges of x and y corresponding to the rectangular
region bounding C. If xr = [x0, x1] and yr = [y0,y1] then
x goes from x0 to x1 as the second index of C goes from 0 to nc,
etc. (x0, y0) is the outermost corner of cell (0,0), and (x1, y1)
is the outermost corner of cell (nr-1, nc-1). All cells are
rectangles of the same size. This is the fastest version.
x, y are 1D arrays of length nc+1 and nr+1, respectively, giving
the x and y boundaries of the cells. Hence the cells are
rectangular but the grid may be nonuniform. The speed is
intermediate. (The grid is checked, and if found to be
uniform the fast version is used.)
X and Y are 2D arrays with shape (nr+1, nc+1) that specify
the (x,y) coordinates of the corners of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). The cells need not be rectangular.
This is the most general, but the slowest to render. It may
produce faster and more compact output using ps, pdf, and
svg backends, however.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* alpha=1.0 : the alpha blending value
Return value is an image if a regular or rectangular grid
is specified, and a QuadMesh collection in the general
quadrilateral case.
- pcolormesh(self, *args, **kwargs)
- PCOLORMESH(*args, **kwargs)
Function signatures
PCOLORMESH(C) - make a pseudocolor plot of matrix C
PCOLORMESH(X, Y, C) - a pseudo color plot of C on the matrices X and Y
PCOLORMESH(C, **kwargs) - Use keyword args to control colormapping and
scaling; see below
C may be a masked array, but X and Y may not. Masked array support
is implemented via cmap and norm; in contrast, pcolor simply does
not draw quadrilaterals with masked colors or vertices.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm.
* norm = Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1. Instantiate it
with clip=False if C is a masked array.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used.
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
More flexible specification of edgecolors, as in pcolor,
is not presently supported.
* alpha=1.0 : the alpha blending value
Return value is a collections.PatchCollection
object
See pcolor for an explantion of the grid orientation and the
expansion of 1-D X and/or Y to 2-D arrays.
kwargs can be used to control the collections.QuadMesh polygon
collection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pick(self, *args)
- pick(mouseevent)
each child artist will fire a pick event if mouseevent is over
the artist and the artist has picker set
- pie(self, x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.59999999999999998, shadow=False, labeldistance=1.1000000000000001)
- PIE(x, explode=None, labels=None,
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
autopct=None, pctdistance=0.6, labeldistance=1.1, shadow=False)
Make a pie chart of array x. The fractional area of each wedge is
given by x/sum(x). If sum(x)<=1, then the values of x give the
fractional area directly and the array will not be normalized.
- explode, if not None, is a len(x) array which specifies the
fraction of the radius to offset that wedge.
- colors is a sequence of matplotlib color args that the pie chart
will cycle.
- labels, if not None, is a len(x) list of labels.
- autopct, if not None, is a string or function used to label the
wedges with their numeric value. The label will be placed inside
the wedge. If it is a format string, the label will be fmt%pct.
If it is a function, it will be called
- pctdistance is the ratio between the center of each pie slice
and the start of the text generated by autopct. Ignored if autopct
is None; default is 0.6.
- labeldistance is the radial distance at which the pie labels are drawn
- shadow, if True, will draw a shadow beneath the pie.
The pie chart will probably look best if the figure and axes are
square. Eg,
figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])
Return value:
If autopct is None, return a list of (patches, texts), where patches
is a sequence of mpatches.Wedge instances and texts is a
list of the label Text instnaces
If autopct is not None, return (patches, texts, autotexts), where
patches and texts are as above, and autotexts is a list of text
instances for the numeric labels
- plot(self, *args, **kwargs)
- PLOT(*args, **kwargs)
Plot lines and/or markers to the Axes. *args is a variable length
argument, allowing for multiple x,y pairs with an optional format
string. For example, each of the following is legal
plot(x,y) # plot x and y using the default line style and color
plot(x,y, 'bo') # plot x and y using blue circle markers
plot(y) # plot y using x as index array 0..N-1
plot(y, 'r+') # ditto, but with red plusses
If x and/or y is 2-Dimensional, then the corresponding columns
will be plotted.
An arbitrary number of x, y, fmt groups can be specified, as in
a.plot(x1, y1, 'g^', x2, y2, 'g-')
Return value is a list of lines that were added.
The following line styles are supported:
- : solid line
-- : dashed line
-. : dash-dot line
: : dotted line
. : points
, : pixels
o : circle symbols
^ : triangle up symbols
v : triangle down symbols
< : triangle left symbols
> : triangle right symbols
s : square symbols
+ : plus symbols
x : cross symbols
D : diamond symbols
d : thin diamond symbols
1 : tripod down symbols
2 : tripod up symbols
3 : tripod left symbols
4 : tripod right symbols
h : hexagon symbols
H : rotated hexagon symbols
p : pentagon symbols
| : vertical line symbols
_ : horizontal line symbols
steps : use gnuplot style 'steps' # kwarg only
The following color abbreviations are supported
b : blue
g : green
r : red
c : cyan
m : magenta
y : yellow
k : black
w : white
In addition, you can specify colors in many weird and
wonderful ways, including full names 'green', hex strings
'#008000', RGB or RGBA tuples (0,1,0,1) or grayscale
intensities as a string '0.8'. Of these, the string
specifications can be used in place of a fmt group, but the
tuple forms can be used only as kwargs.
Line styles and colors are combined in a single format string, as in
'bo' for blue circles.
The **kwargs can be used to set line properties (any property that has
a set_* method). You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc. Here is an
example:
plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
plot([1,2,3], [1,4,9], 'rs', label='line 2')
axis([0, 4, 0, 10])
legend()
If you make multiple lines with one plot command, the kwargs apply
to all those lines, eg
plot(x1, y1, x2, y2, antialised=False)
Neither line will be antialiased.
The 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
kwargs scalex and scaley, if defined, are passed on
to autoscale_view to determine whether the x and y axes are
autoscaled; default True. See Axes.autoscale_view for more
information
- plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
- PLOT_DATE(x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
Similar to the plot() command, except the x or y (or both) data
is considered to be dates, and the axis is labeled accordingly.
x or y (or both) can be a sequence of dates represented as
float days since 0001-01-01 UTC.
fmt is a plot format string.
tz is the time zone to use in labelling dates. Defaults to rc value.
If xdate is True, the x-axis will be labeled with dates.
If ydate is True, the y-axis will be labeled with dates.
Note if you are using custom date tickers and formatters, it
may be necessary to set the formatters/locators after the call
to plot_date since plot_date will set the default tick locator
to ticker.AutoDateLocator (if the tick locator is not already set to
a ticker.DateLocator instance) and the default tick formatter to
AutoDateFormatter (if the tick formatter is not already set to
a DateFormatter instance).
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
See dates for helper functions date2num, num2date
and drange for help on creating the required floating point dates
- psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=0, **kwargs)
- PSD(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=0, **kwargs)
The power spectral density by Welches average periodogram method. The
vector x is divided into NFFT length segments. Each segment is
detrended by function detrend and windowed by function window.
noperlap gives the length of the overlap between segments. The
absolute(fft(segment))**2 of each segment are averaged to compute Pxx,
with a scaling to correct for power loss due to windowing. Fs is the
sampling frequency.
* NFFT is the length of the fft segment; must be a power of 2
* Fs is the sampling frequency.
* Fc is the center frequency of x (defaults to 0), which offsets
the yextents of the image to reflect the frequency range used
when a signal is acquired and then filtered and downsampled to
baseband.
* detrend - the function applied to each segment before fft-ing,
designed to remove the mean or linear trend. Unlike in matlab,
where the detrend parameter is a vector, in matplotlib is it a
function. The mlab module defines detrend_none, detrend_mean,
detrend_linear, but you can use a custom function as well.
* window - the function used to window the segments. window is a
function, unlike in matlab(TM) where it is a vector. mlab defines
window_none, window_hanning, but you can use a custom function
as well.
* noverlap gives the length of the overlap between segments.
Returns the tuple Pxx, freqs
For plotting, the power is plotted as 10*npy.log10(pxx) for decibels,
though pxx itself is returned
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- quiver(self, *args, **kw)
- Plot a 2-D field of arrows.
Function signatures:
quiver(U, V, **kw)
quiver(U, V, C, **kw)
quiver(X, Y, U, V, **kw)
quiver(X, Y, U, V, C, **kw)
Arguments:
X, Y give the x and y coordinates of the arrow locations
(default is tail of arrow; see 'pivot' kwarg)
U, V give the x and y components of the arrow vectors
C is an optional array used to map colors to the arrows
All arguments may be 1-D or 2-D arrays or sequences.
If X and Y are absent, they will be generated as a uniform grid.
If U and V are 2-D arrays but X and Y are 1-D, and if
len(X) and len(Y) match the column and row dimensions
of U, then X and Y will be expanded with meshgrid.
U, V, C may be masked arrays, but masked X, Y are not
supported at present.
Keyword arguments (default given first):
* units = 'width' | 'height' | 'dots' | 'inches' | 'x' | 'y'
arrow units; the arrow dimensions *except for length*
are in multiples of this unit.
* scale = None | float
data units per arrow unit, e.g. m/s per plot width;
a smaller scale parameter makes the arrow longer.
If None, a simple autoscaling algorithm is used, based
on the average vector length and the number of vectors.
Arrow dimensions and scales can be in any of several units:
'width' or 'height': the width or height of the axes
'dots' or 'inches': pixels or inches, based on the figure dpi
'x' or 'y': X or Y data units
In all cases the arrow aspect ratio is 1, so that if U==V the angle
of the arrow on the plot is 45 degrees CCW from the X-axis.
The arrows scale differently depending on the units, however.
For 'x' or 'y', the arrows get larger as one zooms in; for other
units, the arrow size is independent of the zoom state. For
'width or 'height', the arrow size increases with the width and
height of the axes, respectively, when the the window is resized;
for 'dots' or 'inches', resizing does not change the arrows.
* width = ? shaft width in arrow units; default depends on
choice of units, above, and number of vectors;
a typical starting value is about
0.005 times the width of the plot.
* headwidth = 3 head width as multiple of shaft width
* headlength = 5 head length as multiple of shaft width
* headaxislength = 4.5 head length at shaft intersection
* minshaft = 1 length below which arrow scales, in units
of head length. Do not set this to less
than 1, or small arrows will look terrible!
* minlength = 1 minimum length as a multiple of shaft width;
if an arrow length is less than this, plot a
dot (hexagon) of this diameter instead.
The defaults give a slightly swept-back arrow; to make the
head a triangle, make headaxislength the same as headlength.
To make the arrow more pointed, reduce headwidth or increase
headlength and headaxislength.
To make the head smaller relative to the shaft, scale down
all the head* parameters.
You will probably do best to leave minshaft alone.
* pivot = 'tail' | 'middle' | 'tip'
The part of the arrow that is at the grid point; the arrow
rotates about this point, hence the name 'pivot'.
* color = 'k' | any matplotlib color spec or sequence of color specs.
This is a synonym for the PolyCollection facecolor kwarg.
If C has been set, 'color' has no effect.
* All PolyCollection kwargs are valid, in the sense that they
will be passed on to the PolyCollection constructor.
In particular, one might want to use, for example:
linewidths = (1,), edgecolors = ('g',)
to make the arrows have green outlines of unit width.
- quiverkey(self, *args, **kw)
- Add a key to a quiver plot.
Function signature:
quiverkey(Q, X, Y, U, label, **kw)
Arguments:
Q is the Quiver instance returned by a call to quiver.
X, Y give the location of the key; additional explanation follows.
U is the length of the key
label is a string with the length and units of the key
Keyword arguments (default given first):
* coordinates = 'axes' | 'figure' | 'data' | 'inches'
Coordinate system and units for X, Y: 'axes' and 'figure'
are normalized coordinate systems with 0,0 in the lower
left and 1,1 in the upper right; 'data' are the axes
data coordinates (used for the locations of the vectors
in the quiver plot itself); 'inches' is position in the
figure in inches, with 0,0 at the lower left corner.
* color overrides face and edge colors from Q.
* labelpos = 'N' | 'S' | 'E' | 'W'
Position the label above, below, to the right, to the left
of the arrow, respectively.
* labelsep = 0.1 inches distance between the arrow and the label
* labelcolor (defaults to default Text color)
* fontproperties is a dictionary with keyword arguments accepted
by the FontProperties initializer: family, style, variant,
size, weight
Any additional keyword arguments are used to override vector
properties taken from Q.
The positioning of the key depends on X, Y, coordinates, and
labelpos. If labelpos is 'N' or 'S', X,Y give the position
of the middle of the key arrow. If labelpos is 'E', X,Y
positions the head, and if labelpos is 'W', X,Y positions the
tail; in either of these two cases, X,Y is somewhere in the middle
of the arrow+label key object.
- redraw_in_frame(self)
- 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)
- relim(self)
- recompute the datalimits based on current artists
- scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, faceted=True, verts=None, **kwargs)
- SCATTER(x, y, s=20, c='b', marker='o', cmap=None, norm=None,
vmin=None, vmax=None, alpha=1.0, linewidths=None,
faceted=True, **kwargs)
Supported function signatures:
SCATTER(x, y, **kwargs)
SCATTER(x, y, s, **kwargs)
SCATTER(x, y, s, c, **kwargs)
Make a scatter plot of x versus y, where x, y are 1-D sequences
of the same length, N.
Arguments s and c can also be given as kwargs; this is encouraged
for readability.
s is a size in points^2. It is a scalar
or an array of the same length as x and y.
c is a color and can be a single color format string,
or a sequence of color specifications of length N,
or a sequence of N numbers to be mapped to colors
using the cmap and norm specified via kwargs (see below).
Note that c should not be a single numeric RGB or RGBA
sequence because that is indistinguishable from an array
of values to be colormapped. c can be a 2-D array in which
the rows are RGB or RGBA, however.
The marker can be one of
's' : square
'o' : circle
'^' : triangle up
'>' : triangle right
'v' : triangle down
'<' : triangle left
'd' : diamond
'p' : pentagram
'h' : hexagon
'8' : octagon
If marker is None and verts is not None, verts is a sequence
of (x,y) vertices for a custom scatter symbol.
s is a size argument in points squared.
Any or all of x, y, s, and c may be masked arrays, in which
case all masks will be combined and only unmasked points
will be plotted.
Other keyword args; the color mapping and normalization arguments will
be used only if c is an array of floats
* cmap = cm.jet : a colors.Colormap instance from cm.
defaults to rc image.cmap
* norm = colors.Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. Note if you pass a norm
instance, your settings for vmin and vmax will be ignored
* alpha =1.0 : the alpha value for the patches
* linewidths, if None, defaults to (lines.linewidth,). Note
that this is a tuple, and if you set the linewidths
argument you must set it as a sequence of floats, as
required by RegularPolyCollection -- see
collections.RegularPolyCollection for details
* faceted: if True, will use the default edgecolor for the
markers. If False, will set the edgecolors to be the same
as the facecolors.
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors=None
edgecolors also can be any mpl color or sequence of colors.
Optional kwargs control the PatchCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
A Collection instance is returned
- semilogx(self, *args, **kwargs)
- SEMILOGX(*args, **kwargs)
Make a semilog plot with log scaling on the x axis. The args to
semilog x are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_xscale. Notable, for log scaling:
* basex: base of the logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- semilogy(self, *args, **kwargs)
- SEMILOGY(*args, **kwargs):
Make a semilog plot with log scaling on the y axis. The args to
semilogy are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_yscale. Notable, for log scaling:
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- set_adjustable(self, adjustable)
- ACCEPTS: ['box' | 'datalim']
- set_anchor(self, anchor)
- ACCEPTS: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
- set_aspect(self, aspect, adjustable=None, anchor=None)
- aspect:
'auto' - automatic; fill position rectangle with data
'normal' - same as 'auto'; deprecated
'equal' - same scaling from data to plot units for x and y
num - a circle will be stretched such that the height
is num times the width. aspect=1 is the same as
aspect='equal'.
adjustable:
'box' - change physical size of axes
'datalim' - change xlim or ylim
anchor:
'C' - centered
'SW' - lower left corner
'S' - middle of bottom edge
'SE' - lower right corner
etc.
ACCEPTS: ['auto' | 'equal' | aspect_ratio]
- set_autoscale_on(self, b)
- Set whether autoscaling is applied on plot commands
ACCEPTS: True|False
- set_axis_bgcolor(self, color)
- set the axes background color
ACCEPTS: any matplotlib color - see help(colors)
- set_axis_off(self)
- turn off the axis
ACCEPTS: void
- set_axis_on(self)
- turn on the axis
ACCEPTS: void
- set_axisbelow(self, b)
- Set whether the axis ticks and gridlines are above or below most artists
ACCEPTS: True|False
- set_cursor_props(self, *args)
- Set the cursor property as
ax.set_cursor_props(linewidth, color) OR
ax.set_cursor_props((linewidth, color))
ACCEPTS: a (float, color) tuple
- set_figure(self, fig)
- Set the Axes figure
ACCEPTS: a Figure instance
- set_frame_on(self, b)
- Set whether the axes rectangle patch is drawn
ACCEPTS: True|False
- set_navigate(self, b)
- Set whether the axes responds to navigation toolbar commands
ACCEPTS: True|False
- set_navigate_mode(self, b)
- Set the navigation toolbar button status;
this is not a user-API function.
- set_position(self, pos, which='both')
- Set the axes position with pos = [left, bottom, width, height]
in relative 0,1 coords
There are two position variables: one which is ultimately
used, but which may be modified by apply_aspect, and a second
which is the starting point for apply_aspect.
which = 'active' to change the first;
'original' to change the second;
'both' to change both
ACCEPTS: len(4) sequence of floats
- set_title(self, label, fontdict=None, **kwargs)
- SET_TITLE(label, fontdict=None, **kwargs):
Set the title for the axes. See the text docstring for information
of how override and the optional args work
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: an agg.path_storage instance
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
ACCEPTS: str
- set_xbound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the x-axis.
This method will honor axes inversion regardless of parameter order.
- set_xlabel(self, xlabel, fontdict=None, **kwargs)
- SET_XLABEL(xlabel, fontdict=None, **kwargs)
Set the label for the xaxis. See the text docstring for information
of how override and the optional args work.
Valid 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: an agg.path_storage instance
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
ACCEPTS: str
- set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs)
- set_xlim(self, *args, **kwargs):
Set the limits for the xaxis; v = [xmin, xmax]
set_xlim((valmin, valmax))
set_xlim(valmin, valmax)
set_xlim(xmin=1) # xmax unchanged
set_xlim(xmax=1) # xmin unchanged
Valid kwargs:
xmin : the min of the xlim
xmax : the max of the xlim
emit : notify observers of lim change
Returns the current xlimits as a length 2 tuple
ACCEPTS: len(2) sequence of floats
- set_xscale(self, value, basex=10, subsx=None)
- SET_XSCALE(value, basex=10, subsx=None)
Set the xscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basex: base of the logarithm
* subsx: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsx=(1,2,5) will
put minor ticks on 1,2,5,11,12,15,21, ....To turn off
minor ticking, set subsx=[]
ACCEPTS: ['log' | 'linear' ]
- set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_xticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the xtick labels with list of strings labels Return a list of axis
text instances.
kwargs set the Text properties. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_xticks(self, ticks, minor=False)
- Set the x ticks with list of ticks
ACCEPTS: sequence of floats
- set_ybound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the y-axis.
This method will honor axes inversion regardless of parameter order.
- set_ylabel(self, ylabel, fontdict=None, **kwargs)
- SET_YLABEL(ylabel, fontdict=None, **kwargs)
Set the label for the yaxis
See the text doctstring for information of how override and
the optional args work
Valid 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: an agg.path_storage instance
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
ACCEPTS: str
- set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs)
- set_ylim(self, *args, **kwargs):
Set the limits for the yaxis; v = [ymin, ymax]
set_ylim((valmin, valmax))
set_ylim(valmin, valmax)
set_ylim(ymin=1) # ymax unchanged
set_ylim(ymax=1) # ymin unchanged
Valid kwargs:
ymin : the min of the ylim
ymax : the max of the ylim
emit : notify observers of lim change
Returns the current ylimits as a length 2 tuple
ACCEPTS: len(2) sequence of floats
- set_yscale(self, value, basey=10, subsy=None)
- SET_YSCALE(value, basey=10, subsy=None)
Set the yscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsy=(1,2,5) will
put minor ticks on 1,2,5,11,12,15, 21, ....To turn off
minor ticking, set subsy=[]
ACCEPTS: ['log' | 'linear']
- set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_yticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the ytick labels with list of strings labels. Return a list of
Text instances.
kwargs set Text properties for the labels. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_yticks(self, ticks, minor=False)
- Set the y ticks with list of ticks
ACCEPTS: sequence of floats
- sharex_foreign(self, axforeign)
- You can share your x-axis view limits with another Axes in the
same Figure by using the sharex and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the xaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- sharey_foreign(self, axforeign)
- You can share your y-axis view limits with another Axes in the
same Figure by using the sharey and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the yaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=128, cmap=None, xextent=None)
- SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window = mlab.window_hanning, noverlap=128,
cmap=None, xextent=None)
Compute a spectrogram of data in x. Data are split into NFFT length
segements and the PSD of each section is computed. The windowing
function window is applied to each segment, and the amount of overlap
of each segment is specified with noverlap.
* cmap is a colormap; if None use default determined by rc
* xextent is the image extent in the xaxes xextent=xmin, xmax -
default 0, max(bins), 0, max(freqs) where bins is the return
value from mlab.specgram
* See help(psd) for information on the other keyword arguments.
Return value is (Pxx, freqs, bins, im), where
bins are the time points the spectrogram is calculated over
freqs is an array of frequencies
Pxx is a len(times) x len(freqs) array of power
im is a image.AxesImage.
Note: If x is real (i.e. non-complex) only the positive spectrum is
shown. If x is complex both positive and negative parts of the
spectrum are shown.
- spy(self, Z, precision=None, marker=None, markersize=None, aspect='equal', **kwargs)
- spy(Z) plots the sparsity pattern of the 2-D array Z
If precision is None, any non-zero value will be plotted;
else, values of absolute(Z)>precision will be plotted.
The array will be plotted as it would be printed, with
the first index (row) increasing down and the second
index (column) increasing to the right.
By default aspect is 'equal' so that each array element
occupies a square space; set the aspect kwarg to 'auto'
to allow the plot to fill the plot box, or to any scalar
number to specify the aspect ratio of an array element
directly.
Two plotting styles are available: image or marker. Both
are available for full arrays, but only the marker style
works for scipy.sparse.spmatrix instances.
If marker and markersize are None, an image will be
returned and any remaining kwargs are passed to imshow;
else, a Line2D object will be returned with the value
of marker determining the marker type, and any remaining
kwargs passed to the axes plot method.
If marker and markersize are None, useful kwargs include:
cmap
alpha
See documentation for imshow() for details.
For controlling colors, e.g. cyan background and red marks, use:
cmap = mcolors.ListedColormap(['c','r'])
If marker or markersize is not None, useful kwargs include:
marker
markersize
color
See documentation for plot() for details.
Useful values for marker include:
's' square (default)
'o' circle
'.' point
',' pixel
- stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
- STEM(x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
A stem plot plots vertical lines (using linefmt) at each x location
from the baseline to y, and places a marker there using markerfmt. A
horizontal line at 0 is is plotted using basefmt
Return value is (markerline, stemlines, baseline) .
See
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html
for details and examples/stem_plot.py for a demo.
- step(self, x, y, *args, **kwargs)
- step(x, y, *args, **kwargs)
x and y must be 1-D sequences, and it is assumed, but not checked,
that x is uniformly increasing.
Make a step plot. The args and keyword args to step are the same
as the args to plot. See help plot for more info.
Additional keyword args for step:
* where: can be 'pre', 'post' or 'mid'; if 'pre', the
interval from x[i] to x[i+1] has level y[i];
if 'post', that interval has level y[i+1];
and if 'mid', the jumps in y occur half-way
between the x-values. Default is 'pre'.
- table(self, **kwargs)
- TABLE(cellText=None, cellColours=None,
cellLoc='right', colWidths=None,
rowLabels=None, rowColours=None, rowLoc='left',
colLabels=None, colColours=None, colLoc='center',
loc='bottom', bbox=None):
Add a table to the current axes. Returns a table instance. For
finer grained control over tables, use the Table class and add it
to the axes with add_table.
Thanks to John Gill for providing the class and table.
kwargs control the Table properties:
alpha: float
animated: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
figure: a matplotlib.figure.Figure instance
fontsize: a float in points
label: any string
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- text(self, x, y, s, fontdict=None, withdash=False, **kwargs)
- TEXT(x, y, s, fontdict=None, **kwargs)
Add text in string s to axis at location x,y (data coords)
fontdict is a dictionary to override the default text properties.
If fontdict is None, the defaults are determined by your rc
parameters.
withdash=True will create a TextWithDash instance instead
of a Text instance.
Individual keyword arguments can be used to override any given
parameter
text(x, y, s, fontsize=12)
The default transform specifies that text is in data coords,
alternatively, you can specify text in axis coords (0,0 lower left and
1,1 upper right). The example below places text in the center of the
axes
text(0.5, 0.5,'matplotlib',
horizontalalignment='center',
verticalalignment='center',
transform = ax.transAxes,
)
You can put a rectangular box around the text instance (eg to
set a background color) by using the keyword bbox. bbox is a
dictionary of patches.Rectangle properties (see help
for Rectangle for a list of these). For example
text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
Valid 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: an agg.path_storage instance
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
- ticklabel_format(self, **kwargs)
- Convenience method for manipulating the ScalarFormatter
used by default for linear axes.
kwargs:
style = 'sci' (or 'scientific') or 'plain';
plain turns off scientific notation
axis = 'x', 'y', or 'both'
Only the major ticks are affected.
If the method is called when the ScalarFormatter is not
the one being used, an AttributeError will be raised with
no additional error message.
Additional capabilities and/or friendlier error checking may be added.
- toggle_log_lineary(self)
- toggle between log and linear on the y axis
- twinx(self)
- ax = twinx()
create a twin of Axes for generating a plot with a sharex
x-axis but independent y axis. The y-axis of self will have
ticks on left and the returned axes will have ticks on the
right
- twiny(self)
- ax = twiny()
create a twin of Axes for generating a plot with a shared
y-axis but independent x axis. The x-axis of self will have
ticks on bottom and the returned axes will have ticks on the
top
- update_datalim(self, xys)
- Update the data lim bbox with seq of xy tups or equiv. 2-D array
- update_datalim_numerix(self, x, y)
- Update the data lim bbox with seq of xy tups
- vlines(self, x, ymin, ymax, colors='k', linestyle='solid', label='', **kwargs)
- VLINES(x, ymin, ymax, color='k')
Plot vertical lines at each x from ymin to ymax. ymin or ymax can be
scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the heights of the lines are
determined by ymin and ymax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the collections.LineCollection that was added
kwargs are collections.LineCollection properties:
alpha: float or sequence of floats
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
figure: a matplotlib.figure.Figure instance
label: any string
linestyle: ['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
segments: unknown
transform: a matplotlib.transform transformation instance
verts: unknown
visible: [True | False]
zorder: any number
- xaxis_date(self, tz=None)
- Sets up x-axis ticks and labels that treat the x data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- xaxis_inverted(self)
- Returns True if the x-axis is inverted.
- xcorr(self, x, y, normed=False, detrend=<function detrend_none at 0x868817c>, usevlines=False, maxlags=None, **kwargs)
- XCORR(x, y, normed=False, detrend=mlab.detrend_none, usevlines=False, **kwargs):
Plot the cross correlation between x and y. If normed=True,
normalize the data but the cross correlation at 0-th lag. x
and y are detrended by the detrend callable (default no
normalization. x and y must be equal length
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
- yaxis_date(self, tz=None)
- Sets up y-axis ticks and labels that treat the y data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- yaxis_inverted(self)
- Returns True if the y-axis is inverted.
Data and other attributes defined here:
- scaled = {0: 'linear', 1: 'log'}
Methods inherited from matplotlib.artist.Artist:
- add_callback(self, func)
- convert_xunits(self, x)
- for artists in an axes, if the xaxis as units support,
convert x using xaxis unit type
- convert_yunits(self, y)
- for artists in an axes, if the yaxis as units support,
convert y using yaxis unit type
- get_alpha(self)
- Return the alpha value used for blending - not supported on all
backends
- get_animated(self)
- return the artist's animated state
- get_axes(self)
- return the axes instance the artist resides in, or None
- get_clip_box(self)
- Return artist clipbox
- get_clip_on(self)
- Return whether artist uses clipping
- get_clip_path(self)
- Return artist clip path
- get_contains(self)
- return the _contains test used by the artist, or None for default.
- get_figure(self)
- return the figure instance
- get_label(self)
- get_picker(self)
- return the Pickeration instance used by this artist
- get_transform(self)
- return the Transformation instance used by this artist
- get_visible(self)
- return the artist's visiblity
- get_zorder(self)
- have_units(self)
- return True if units are set on the x or y axes
- hitlist(self, event)
- List the children of the artist which contain the mouse event
- is_figure_set(self)
- is_transform_set(self)
- Artist has transform explicity let
- pchanged(self)
- fire event when property changed
- pickable(self)
- return True if self is pickable
- remove(self)
- Remove the artist from the figure if possible. The effect will not
be visible until the figure is redrawn, e.g., with ax.draw_idle().
Call ax.relim() to update the axes limits if desired.
Note: relim() will not see collections even if the collection
was added to axes with autolim=True.
Note: there is no support for removing the artist's legend entry.
- remove_callback(self, oid)
- set(self, **kwargs)
- A tkstyle set command, pass kwargs to set properties
- set_alpha(self, alpha)
- Set the alpha value used for blending - not supported on
all backends
ACCEPTS: float
- set_animated(self, b)
- set the artist's animation state
ACCEPTS: [True | False]
- set_axes(self, axes)
- set the axes instance the artist resides in, if any
ACCEPTS: an axes instance
- set_clip_box(self, clipbox)
- Set the artist's clip Bbox
ACCEPTS: a matplotlib.transform.Bbox instance
- set_clip_on(self, b)
- Set whether artist uses clipping
ACCEPTS: [True | False]
- set_clip_path(self, path)
- Set the artist's clip path
ACCEPTS: an agg.path_storage instance
- set_contains(self, picker)
- Replace the contains test used by this artist. The new picker should
be a callable function which determines whether the artist is hit by the
mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit=True and props
is a dictionary of properties you want returned with the contains test.
- set_label(self, s)
- Set the line label to s for auto legend
ACCEPTS: any string
- set_lod(self, on)
- Set Level of Detail on or off. If on, the artists may examine
things like the pixel width of the axes and draw a subset of
their contents accordingly
ACCEPTS: [True | False]
- set_picker(self, picker)
- set the epsilon for picking used by this artist
picker can be one of the following:
None - picking is disabled for this artist (default)
boolean - if True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist
float - if picker is a number it is interpreted as an
epsilon tolerance in points and the the artist will fire
off an event if it's data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, eg the indices of the data within
epsilon of the pick event
function - if picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event.
hit, props = picker(artist, mouseevent)
to determine the hit test. if the mouse event is over the
artist, return hit=True and props is a dictionary of
properties you want added to the PickEvent attributes
ACCEPTS: [None|float|boolean|callable]
- set_transform(self, t)
- set the Transformation instance used by this artist
ACCEPTS: a matplotlib.transform transformation instance
- set_visible(self, b)
- set the artist's visiblity
ACCEPTS: [True | False]
- set_zorder(self, level)
- Set the zorder for the artist
ACCEPTS: any number
- update(self, props)
- update_from(self, other)
- copy properties from other to self
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
- zorder = 0
|
class PolarAxes(Axes) |
|
Make a PolarAxes. The rectangular bounding box of the axes is given by
PolarAxes(position=[left, bottom, width, height])
where all the arguments are fractions in [0,1] which specify the
fraction of the total figure window.
axisbg is the color of the axis background
Attributes:
thetagridlines : a list of Line2D for the theta grids
rgridlines : a list of Line2D for the radial grids
thetagridlabels : a list of Text for the theta grid labels
rgridlabels : a list of Text for the theta grid labels |
|
- Method resolution order:
- PolarAxes
- Axes
- matplotlib.artist.Artist
Methods defined here:
- __init__(self, *args, **kwarg)
- See Axes base class for args and kwargs documentation
- autoscale_view(self, scalex=True, scaley=True)
- set the view limits to include all the data in the axes
- cla(self)
- Clear the current axes
- contains(self, mouseevent)
- Test whether the mouse event occured in the axes.
Returns T/F, {}
- draw(self, renderer)
- format_coord(self, theta, r)
- return a format string formatting the coordinate
- get_children(self)
- return a list of child artists
- get_rmax(self)
- get the maximum radius in the view limits dimension
- get_xscale(self)
- return the xaxis scale string
- get_yscale(self)
- return the yaxis scale string
- grid(self, b)
- Set the axes grids on or off; b is a boolean
- has_data(self)
- return true if any artists have been added to axes
- regrid(self, rmax)
- set_rgrids(self, radii, labels=None, angle=22.5, rpad=0.050000000000000003, **kwargs)
- set the radial locations and labels of the r grids
The labels will appear at radial distances radii at angle
labels, if not None, is a len(radii) list of strings of the
labels to use at each angle.
if labels is None, the self.rformatter will be used
rpad is a fraction of the max of radii which will pad each of
the radial labels in the radial direction.
Return value is a list of lines, labels where the lines are
lines.Line2D instances and the labels are text.Text
instances
kwargs control the rgrid Text label 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: an agg.path_storage instance
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
ACCEPTS: sequence of floats
- set_rmax(self, rmax)
- set_thetagrids(self, angles, labels=None, fmt='%d', frac=1.1000000000000001, **kwargs)
- set the angles at which to place the theta grids (these
gridlines are equal along the theta dimension). angles is in
degrees
labels, if not None, is a len(angles) list of strings of the
labels to use at each angle.
if labels is None, the labels with be fmt%angle
frac is the fraction of the polar axes radius at which to
place the label (1 is the edge).Eg 1.05 isd outside the axes
and 0.95 is inside the axes
Return value is a list of lines, labels where the lines are
lines.Line2D instances and the labels are Text
instances:
kwargs are optional text properties for the labels
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: an agg.path_storage instance
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
ACCEPTS: sequence of floats
- set_xlabel(self, xlabel, fontdict=None, **kwargs)
- xlabel not implemented
- set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs)
- xlim not implemented
- set_ylabel(self, ylabel, fontdict=None, **kwargs)
- ylabel not implemented
- set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs)
- ylim not implemented
- table(self, *args, **kwargs)
- TABLE(*args, **kwargs)
Not implemented for polar axes
- toggle_log_lineary(self)
- toggle between log and linear axes ignored for polar
Data and other attributes defined here:
- RESOLUTION = 100
Methods inherited from Axes:
- __str__(self)
- acorr(self, x, **kwargs)
- 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=False)
- 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)
- 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
- 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.
'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: an agg.path_storage instance
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, data_ratio=None)
- Use self._aspect and self._adjustable to modify the
axes box or the view limits.
The data_ratio kwarg is set to 1 for polar axes. It is
used only when _adjustable is 'box'.
- 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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
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'
- 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 0x868817c>, window=<function window_hanning at 0x868802c>, 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
- 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 0x868817c>, window=<function window_hanning at 0x868802c>, 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*npy.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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- disconnect(self, cid)
- disconnect from the Axes event.
- 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)
- errorbar(self, x, y, yerr=None, xerr=None, fmt='-', ecolor=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, 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.
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- 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_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_cursor_props(self)
- return the cursor props as a linewidth, color tuple where
linewidth is a float and color is an RGBA tuple
- 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 axes rectangle left, bottom, width, height
- get_renderer_cache(self)
- 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_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_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_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_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_ylim(self)
- Get the y axis range [ymin, ymax]
- 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_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
- hist(self, x, bins=10, normed=0, bottom=None, align='edge', orientation='vertical', width=None, log=False, **kwargs)
- HIST(x, bins=10, normed=0, bottom=None,
align='edge', orientation='vertical', width=None,
log=False, **kwargs)
Compute the histogram of x. bins is either an integer number of
bins or a sequence giving the bins. x are the data to be binned.
The return values is (n, bins, patches)
If normed is true, the first element of the return tuple will
be the counts normalized to form a probability density, ie,
n/(len(x)*dbin). In a probability density, the integral of
the histogram should be one (we assume equally spaced bins);
you can verify that with
# trapezoidal integration of the probability density function
pdf, bins, patches = ax.hist(...)
print npy.trapz(pdf, bins)
align = 'edge' | 'center'. Interprets bins either as edge
or center values
orientation = 'horizontal' | 'vertical'. If horizontal, barh
will be used and the "bottom" kwarg will be the left edges.
width: the width of the bars. If None, automatically compute
the width.
log: if True, the histogram axis will be set to a log scale
kwargs are used to update the properties of the
hist Rectangles:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- hlines(self, y, xmin, xmax, colors='k', linestyle='solid', label='', **kwargs)
- HLINES(y, xmin, xmax, colors='k', linestyle='solid', **kwargs)
plot horizontal lines at each y from xmin to xmax. xmin or xmax can
be scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the widths of the lines are
determined by xmin and xmax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the LineCollection that was added
- hold(self, b=None)
- HOLD(b=None)
Set the hold state. If hold is None (default), toggle the
hold state. Else set the hold state to boolean value b.
Eg
hold() # toggle hold
hold(True) # hold is on
hold(False) # hold is off
When hold is True, subsequent plot commands will be added to
the current axes. When hold is False, the current axes and
figure will be cleared on the next plot command
- imshow(self, X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=1.0, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, **kwargs)
- IMSHOW(X, cmap=None, norm=None, aspect=None, interpolation=None,
alpha=1.0, vmin=None, vmax=None, origin=None, extent=None)
IMSHOW(X) - plot image X to current axes, resampling to scale to axes
size (X may be numpy array or PIL image)
IMSHOW(X, **kwargs) - Use keyword args to control image scaling,
colormapping etc. See below for details
Display the image in X to current axes. X may be a float array, a
uint8 array or a PIL image. If X is an array, X can have the following
shapes:
MxN : luminance (grayscale, float array only)
MxNx3 : RGB (float or uint8 array)
MxNx4 : RGBA (float or uint8 array)
The value for each component of MxNx3 and MxNx4 float arrays should be
in the range 0.0 to 1.0; MxN float arrays may be normalised.
A image.AxesImage instance is returned
The following kwargs are allowed:
* cmap is a cm colormap instance, eg cm.jet. If None, default to rc
image.cmap value (Ignored when X has RGB(A) information)
* aspect is one of: auto, equal, or a number. If None, default to rc
image.aspect value
* interpolation is one of:
'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
'lanczos', 'blackman'
if interpolation is None, default to rc
image.interpolation. See also th the filternorm and
filterrad parameters
* norm is a mcolors.Normalize instance; default is
normalization(). This scales luminance -> 0-1 (only used for an
MxN float array).
* vmin and vmax are used to scale a luminance image to 0-1. If
either is None, the min and max of the luminance values will be
used. Note if you pass a norm instance, the settings for vmin and
vmax will be ignored.
* alpha = 1.0 : the alpha blending value
* origin is 'upper' or 'lower', to place the [0,0]
index of the array in the upper left or lower left corner of
the axes. If None, default to rc image.origin
* extent is (left, right, bottom, top) data values of the
axes. The default assigns zero-based row, column indices
to the x, y centers of the pixels.
* shape is for raw buffer images
* filternorm is a parameter for the antigrain image resize
filter. From the antigrain documentation, if normalize=1,
the filter normalizes integer values and corrects the
rounding errors. It doesn't do anything with the source
floating point values, it corrects only integers according
to the rule of 1.0 which means that any sum of pixel
weights must be equal to 1.0. So, the filter function
must produce a graph of the proper shape.
* filterrad: the filter radius for filters that have a radius
parameter, ie when interpolation is one of: 'sinc',
'lanczos' or 'blackman'
Additional kwargs are martist properties
- in_axes(self, xwin, ywin)
- return True is the point xwin, ywin (display coords) are in the Axes
- invert_xaxis(self)
- Invert the x-axis.
- invert_yaxis(self)
- Invert the y-axis.
- ishold(self)
- return the HOLD status of the axes
- legend(self, *args, **kwargs)
- LEGEND(*args, **kwargs)
Place a legend on the current axes at location loc. Labels are a
sequence of strings and loc can be a string or an integer specifying
the legend location
USAGE:
Make a legend with existing lines
>>> legend()
legend by itself will try and build a legend using the label
property of the lines/patches/collections. You can set the label of
a line by doing plot(x, y, label='my data') or line.set_label('my
data'). If label is set to '_nolegend_', the item will not be shown
in legend.
# automatically generate the legend from labels
legend( ('label1', 'label2', 'label3') )
# Make a legend for a list of lines and labels
legend( (line1, line2, line3), ('label1', 'label2', 'label3') )
# Make a legend at a given location, using a location argument
# legend( LABELS, LOC ) or
# legend( LINES, LABELS, LOC )
legend( ('label1', 'label2', 'label3'), loc='upper left')
legend( (line1, line2, line3), ('label1', 'label2', 'label3'), loc=2)
The location codes are
'best' : 0,
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right' : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center' : 10,
If none of these are suitable, loc can be a 2-tuple giving x,y
in axes coords, ie,
loc = 0, 1 is left top
loc = 0.5, 0.5 is center, center
and so on. The following kwargs are supported:
isaxes=True # whether this is an axes legend
numpoints = 4 # the number of points in the legend line
prop = FontProperties(size='smaller') # the font property
pad = 0.2 # the fractional whitespace inside the legend border
markerscale = 0.6 # the relative size of legend markers vs. original
shadow # if True, draw a shadow behind legend
labelsep = 0.005 # the vertical space between the legend entries
handlelen = 0.05 # the length of the legend lines
handletextsep = 0.02 # the space between the legend line and legend text
axespad = 0.02 # the border between the axes and legend edge
- loglog(self, *args, **kwargs)
- LOGLOG(*args, **kwargs)
Make a loglog plot with log scaling on the a and y axis. The args
to semilog x are the same as the args to plot. See help plot for
more info.
Optional keyword args supported are any of the kwargs
supported by plot or set_xscale or set_yscale. Notable, for
log scaling:
* basex: base of the x logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
* basey: base of the y logarithm
* subsy: the location of the minor yticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- matshow(self, Z, **kwargs)
- Plot a matrix as an image.
The matrix will be shown the way it would be printed,
with the first row at the top. Row and column numbering
is zero-based.
Argument:
Z anything that can be interpreted as a 2-D array
kwargs: all are passed to imshow. matshow sets defaults
for extent, origin, interpolation, and aspect; use care
in overriding the extent and origin kwargs, because they
interact. (Also, if you want to change them, you probably
should be using imshow directly in your own version of
matshow.)
Returns: an image.AxesImage instance
- pcolor(self, *args, **kwargs)
- pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the array of color values
X and Y, if given, specify the (x,y) coordinates of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). Ideally the dimensions of X and Y
should be one greater than those of C; if the dimensions are the
same, then the last row and column of C will be ignored.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
If either or both of X and Y are 1-D arrays or column vectors,
they will be expanded as needed into the appropriate 2-D arrays,
making a rectangular grid.
X,Y and C may be masked arrays. If either C[i,j], or one
of the vertices surrounding C[i,j] (X or Y at [i,j],[i+1,j],
[i,j+1],[i=1,j+1]) is masked, nothing is plotted.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
edgecolors can also be None to specify the rcParams
default, or any mpl color or sequence of colors.
* alpha=1.0 : the alpha blending value
Return value is a mcoll.PatchCollection
object
Grid Orientation
The orientation follows the Matlab(TM) convention: an
array C with shape (nrows, ncolumns) is plotted with
the column number as X and the row number as Y, increasing
up; hence it is plotted the way the array would be printed,
except that the Y axis is reversed. That is, C is taken
as C(y,x).
Similarly for meshgrid:
x = npy.arange(5)
y = npy.arange(3)
X, Y = meshgrid(x,y)
is equivalent to
X = array([[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]])
Y = array([[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[2, 2, 2, 2, 2]])
so if you have
C = rand( len(x), len(y))
then you need
pcolor(X, Y, C.T)
or
pcolor(C.T)
Dimensions
Matlab pcolor always discards
the last row and column of C, but matplotlib displays
the last row and column if X and Y are not specified, or
if X and Y have one more row and column than C.
kwargs can be used to control the PolyCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pcolorfast(self, *args, **kwargs)
- Experimental; this is a version of pcolor that
does not draw lines, that provides the fastest
possible rendering with the Agg backend, and that
can handle any quadrilateral grid.
pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(xr, yr, C, **kwargs)
pcolor(x, y, C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the 2D array of color values corresponding to quadrilateral
cells. Let (nr, nc) be its shape. C may be a masked array.
pcolor(C, **kwargs) is equivalent to
pcolor([0,nc], [0,nr], C, **kwargs)
xr, yr specify the ranges of x and y corresponding to the rectangular
region bounding C. If xr = [x0, x1] and yr = [y0,y1] then
x goes from x0 to x1 as the second index of C goes from 0 to nc,
etc. (x0, y0) is the outermost corner of cell (0,0), and (x1, y1)
is the outermost corner of cell (nr-1, nc-1). All cells are
rectangles of the same size. This is the fastest version.
x, y are 1D arrays of length nc+1 and nr+1, respectively, giving
the x and y boundaries of the cells. Hence the cells are
rectangular but the grid may be nonuniform. The speed is
intermediate. (The grid is checked, and if found to be
uniform the fast version is used.)
X and Y are 2D arrays with shape (nr+1, nc+1) that specify
the (x,y) coordinates of the corners of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). The cells need not be rectangular.
This is the most general, but the slowest to render. It may
produce faster and more compact output using ps, pdf, and
svg backends, however.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* alpha=1.0 : the alpha blending value
Return value is an image if a regular or rectangular grid
is specified, and a QuadMesh collection in the general
quadrilateral case.
- pcolormesh(self, *args, **kwargs)
- PCOLORMESH(*args, **kwargs)
Function signatures
PCOLORMESH(C) - make a pseudocolor plot of matrix C
PCOLORMESH(X, Y, C) - a pseudo color plot of C on the matrices X and Y
PCOLORMESH(C, **kwargs) - Use keyword args to control colormapping and
scaling; see below
C may be a masked array, but X and Y may not. Masked array support
is implemented via cmap and norm; in contrast, pcolor simply does
not draw quadrilaterals with masked colors or vertices.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm.
* norm = Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1. Instantiate it
with clip=False if C is a masked array.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used.
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
More flexible specification of edgecolors, as in pcolor,
is not presently supported.
* alpha=1.0 : the alpha blending value
Return value is a collections.PatchCollection
object
See pcolor for an explantion of the grid orientation and the
expansion of 1-D X and/or Y to 2-D arrays.
kwargs can be used to control the collections.QuadMesh polygon
collection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pick(self, *args)
- pick(mouseevent)
each child artist will fire a pick event if mouseevent is over
the artist and the artist has picker set
- pie(self, x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.59999999999999998, shadow=False, labeldistance=1.1000000000000001)
- PIE(x, explode=None, labels=None,
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
autopct=None, pctdistance=0.6, labeldistance=1.1, shadow=False)
Make a pie chart of array x. The fractional area of each wedge is
given by x/sum(x). If sum(x)<=1, then the values of x give the
fractional area directly and the array will not be normalized.
- explode, if not None, is a len(x) array which specifies the
fraction of the radius to offset that wedge.
- colors is a sequence of matplotlib color args that the pie chart
will cycle.
- labels, if not None, is a len(x) list of labels.
- autopct, if not None, is a string or function used to label the
wedges with their numeric value. The label will be placed inside
the wedge. If it is a format string, the label will be fmt%pct.
If it is a function, it will be called
- pctdistance is the ratio between the center of each pie slice
and the start of the text generated by autopct. Ignored if autopct
is None; default is 0.6.
- labeldistance is the radial distance at which the pie labels are drawn
- shadow, if True, will draw a shadow beneath the pie.
The pie chart will probably look best if the figure and axes are
square. Eg,
figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])
Return value:
If autopct is None, return a list of (patches, texts), where patches
is a sequence of mpatches.Wedge instances and texts is a
list of the label Text instnaces
If autopct is not None, return (patches, texts, autotexts), where
patches and texts are as above, and autotexts is a list of text
instances for the numeric labels
- plot(self, *args, **kwargs)
- PLOT(*args, **kwargs)
Plot lines and/or markers to the Axes. *args is a variable length
argument, allowing for multiple x,y pairs with an optional format
string. For example, each of the following is legal
plot(x,y) # plot x and y using the default line style and color
plot(x,y, 'bo') # plot x and y using blue circle markers
plot(y) # plot y using x as index array 0..N-1
plot(y, 'r+') # ditto, but with red plusses
If x and/or y is 2-Dimensional, then the corresponding columns
will be plotted.
An arbitrary number of x, y, fmt groups can be specified, as in
a.plot(x1, y1, 'g^', x2, y2, 'g-')
Return value is a list of lines that were added.
The following line styles are supported:
- : solid line
-- : dashed line
-. : dash-dot line
: : dotted line
. : points
, : pixels
o : circle symbols
^ : triangle up symbols
v : triangle down symbols
< : triangle left symbols
> : triangle right symbols
s : square symbols
+ : plus symbols
x : cross symbols
D : diamond symbols
d : thin diamond symbols
1 : tripod down symbols
2 : tripod up symbols
3 : tripod left symbols
4 : tripod right symbols
h : hexagon symbols
H : rotated hexagon symbols
p : pentagon symbols
| : vertical line symbols
_ : horizontal line symbols
steps : use gnuplot style 'steps' # kwarg only
The following color abbreviations are supported
b : blue
g : green
r : red
c : cyan
m : magenta
y : yellow
k : black
w : white
In addition, you can specify colors in many weird and
wonderful ways, including full names 'green', hex strings
'#008000', RGB or RGBA tuples (0,1,0,1) or grayscale
intensities as a string '0.8'. Of these, the string
specifications can be used in place of a fmt group, but the
tuple forms can be used only as kwargs.
Line styles and colors are combined in a single format string, as in
'bo' for blue circles.
The **kwargs can be used to set line properties (any property that has
a set_* method). You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc. Here is an
example:
plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
plot([1,2,3], [1,4,9], 'rs', label='line 2')
axis([0, 4, 0, 10])
legend()
If you make multiple lines with one plot command, the kwargs apply
to all those lines, eg
plot(x1, y1, x2, y2, antialised=False)
Neither line will be antialiased.
The 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
kwargs scalex and scaley, if defined, are passed on
to autoscale_view to determine whether the x and y axes are
autoscaled; default True. See Axes.autoscale_view for more
information
- plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
- PLOT_DATE(x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
Similar to the plot() command, except the x or y (or both) data
is considered to be dates, and the axis is labeled accordingly.
x or y (or both) can be a sequence of dates represented as
float days since 0001-01-01 UTC.
fmt is a plot format string.
tz is the time zone to use in labelling dates. Defaults to rc value.
If xdate is True, the x-axis will be labeled with dates.
If ydate is True, the y-axis will be labeled with dates.
Note if you are using custom date tickers and formatters, it
may be necessary to set the formatters/locators after the call
to plot_date since plot_date will set the default tick locator
to ticker.AutoDateLocator (if the tick locator is not already set to
a ticker.DateLocator instance) and the default tick formatter to
AutoDateFormatter (if the tick formatter is not already set to
a DateFormatter instance).
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
See dates for helper functions date2num, num2date
and drange for help on creating the required floating point dates
- psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=0, **kwargs)
- PSD(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=0, **kwargs)
The power spectral density by Welches average periodogram method. The
vector x is divided into NFFT length segments. Each segment is
detrended by function detrend and windowed by function window.
noperlap gives the length of the overlap between segments. The
absolute(fft(segment))**2 of each segment are averaged to compute Pxx,
with a scaling to correct for power loss due to windowing. Fs is the
sampling frequency.
* NFFT is the length of the fft segment; must be a power of 2
* Fs is the sampling frequency.
* Fc is the center frequency of x (defaults to 0), which offsets
the yextents of the image to reflect the frequency range used
when a signal is acquired and then filtered and downsampled to
baseband.
* detrend - the function applied to each segment before fft-ing,
designed to remove the mean or linear trend. Unlike in matlab,
where the detrend parameter is a vector, in matplotlib is it a
function. The mlab module defines detrend_none, detrend_mean,
detrend_linear, but you can use a custom function as well.
* window - the function used to window the segments. window is a
function, unlike in matlab(TM) where it is a vector. mlab defines
window_none, window_hanning, but you can use a custom function
as well.
* noverlap gives the length of the overlap between segments.
Returns the tuple Pxx, freqs
For plotting, the power is plotted as 10*npy.log10(pxx) for decibels,
though pxx itself is returned
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- quiver(self, *args, **kw)
- Plot a 2-D field of arrows.
Function signatures:
quiver(U, V, **kw)
quiver(U, V, C, **kw)
quiver(X, Y, U, V, **kw)
quiver(X, Y, U, V, C, **kw)
Arguments:
X, Y give the x and y coordinates of the arrow locations
(default is tail of arrow; see 'pivot' kwarg)
U, V give the x and y components of the arrow vectors
C is an optional array used to map colors to the arrows
All arguments may be 1-D or 2-D arrays or sequences.
If X and Y are absent, they will be generated as a uniform grid.
If U and V are 2-D arrays but X and Y are 1-D, and if
len(X) and len(Y) match the column and row dimensions
of U, then X and Y will be expanded with meshgrid.
U, V, C may be masked arrays, but masked X, Y are not
supported at present.
Keyword arguments (default given first):
* units = 'width' | 'height' | 'dots' | 'inches' | 'x' | 'y'
arrow units; the arrow dimensions *except for length*
are in multiples of this unit.
* scale = None | float
data units per arrow unit, e.g. m/s per plot width;
a smaller scale parameter makes the arrow longer.
If None, a simple autoscaling algorithm is used, based
on the average vector length and the number of vectors.
Arrow dimensions and scales can be in any of several units:
'width' or 'height': the width or height of the axes
'dots' or 'inches': pixels or inches, based on the figure dpi
'x' or 'y': X or Y data units
In all cases the arrow aspect ratio is 1, so that if U==V the angle
of the arrow on the plot is 45 degrees CCW from the X-axis.
The arrows scale differently depending on the units, however.
For 'x' or 'y', the arrows get larger as one zooms in; for other
units, the arrow size is independent of the zoom state. For
'width or 'height', the arrow size increases with the width and
height of the axes, respectively, when the the window is resized;
for 'dots' or 'inches', resizing does not change the arrows.
* width = ? shaft width in arrow units; default depends on
choice of units, above, and number of vectors;
a typical starting value is about
0.005 times the width of the plot.
* headwidth = 3 head width as multiple of shaft width
* headlength = 5 head length as multiple of shaft width
* headaxislength = 4.5 head length at shaft intersection
* minshaft = 1 length below which arrow scales, in units
of head length. Do not set this to less
than 1, or small arrows will look terrible!
* minlength = 1 minimum length as a multiple of shaft width;
if an arrow length is less than this, plot a
dot (hexagon) of this diameter instead.
The defaults give a slightly swept-back arrow; to make the
head a triangle, make headaxislength the same as headlength.
To make the arrow more pointed, reduce headwidth or increase
headlength and headaxislength.
To make the head smaller relative to the shaft, scale down
all the head* parameters.
You will probably do best to leave minshaft alone.
* pivot = 'tail' | 'middle' | 'tip'
The part of the arrow that is at the grid point; the arrow
rotates about this point, hence the name 'pivot'.
* color = 'k' | any matplotlib color spec or sequence of color specs.
This is a synonym for the PolyCollection facecolor kwarg.
If C has been set, 'color' has no effect.
* All PolyCollection kwargs are valid, in the sense that they
will be passed on to the PolyCollection constructor.
In particular, one might want to use, for example:
linewidths = (1,), edgecolors = ('g',)
to make the arrows have green outlines of unit width.
- quiverkey(self, *args, **kw)
- Add a key to a quiver plot.
Function signature:
quiverkey(Q, X, Y, U, label, **kw)
Arguments:
Q is the Quiver instance returned by a call to quiver.
X, Y give the location of the key; additional explanation follows.
U is the length of the key
label is a string with the length and units of the key
Keyword arguments (default given first):
* coordinates = 'axes' | 'figure' | 'data' | 'inches'
Coordinate system and units for X, Y: 'axes' and 'figure'
are normalized coordinate systems with 0,0 in the lower
left and 1,1 in the upper right; 'data' are the axes
data coordinates (used for the locations of the vectors
in the quiver plot itself); 'inches' is position in the
figure in inches, with 0,0 at the lower left corner.
* color overrides face and edge colors from Q.
* labelpos = 'N' | 'S' | 'E' | 'W'
Position the label above, below, to the right, to the left
of the arrow, respectively.
* labelsep = 0.1 inches distance between the arrow and the label
* labelcolor (defaults to default Text color)
* fontproperties is a dictionary with keyword arguments accepted
by the FontProperties initializer: family, style, variant,
size, weight
Any additional keyword arguments are used to override vector
properties taken from Q.
The positioning of the key depends on X, Y, coordinates, and
labelpos. If labelpos is 'N' or 'S', X,Y give the position
of the middle of the key arrow. If labelpos is 'E', X,Y
positions the head, and if labelpos is 'W', X,Y positions the
tail; in either of these two cases, X,Y is somewhere in the middle
of the arrow+label key object.
- redraw_in_frame(self)
- 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)
- relim(self)
- recompute the datalimits based on current artists
- scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, faceted=True, verts=None, **kwargs)
- SCATTER(x, y, s=20, c='b', marker='o', cmap=None, norm=None,
vmin=None, vmax=None, alpha=1.0, linewidths=None,
faceted=True, **kwargs)
Supported function signatures:
SCATTER(x, y, **kwargs)
SCATTER(x, y, s, **kwargs)
SCATTER(x, y, s, c, **kwargs)
Make a scatter plot of x versus y, where x, y are 1-D sequences
of the same length, N.
Arguments s and c can also be given as kwargs; this is encouraged
for readability.
s is a size in points^2. It is a scalar
or an array of the same length as x and y.
c is a color and can be a single color format string,
or a sequence of color specifications of length N,
or a sequence of N numbers to be mapped to colors
using the cmap and norm specified via kwargs (see below).
Note that c should not be a single numeric RGB or RGBA
sequence because that is indistinguishable from an array
of values to be colormapped. c can be a 2-D array in which
the rows are RGB or RGBA, however.
The marker can be one of
's' : square
'o' : circle
'^' : triangle up
'>' : triangle right
'v' : triangle down
'<' : triangle left
'd' : diamond
'p' : pentagram
'h' : hexagon
'8' : octagon
If marker is None and verts is not None, verts is a sequence
of (x,y) vertices for a custom scatter symbol.
s is a size argument in points squared.
Any or all of x, y, s, and c may be masked arrays, in which
case all masks will be combined and only unmasked points
will be plotted.
Other keyword args; the color mapping and normalization arguments will
be used only if c is an array of floats
* cmap = cm.jet : a colors.Colormap instance from cm.
defaults to rc image.cmap
* norm = colors.Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. Note if you pass a norm
instance, your settings for vmin and vmax will be ignored
* alpha =1.0 : the alpha value for the patches
* linewidths, if None, defaults to (lines.linewidth,). Note
that this is a tuple, and if you set the linewidths
argument you must set it as a sequence of floats, as
required by RegularPolyCollection -- see
collections.RegularPolyCollection for details
* faceted: if True, will use the default edgecolor for the
markers. If False, will set the edgecolors to be the same
as the facecolors.
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors=None
edgecolors also can be any mpl color or sequence of colors.
Optional kwargs control the PatchCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
A Collection instance is returned
- semilogx(self, *args, **kwargs)
- SEMILOGX(*args, **kwargs)
Make a semilog plot with log scaling on the x axis. The args to
semilog x are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_xscale. Notable, for log scaling:
* basex: base of the logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- semilogy(self, *args, **kwargs)
- SEMILOGY(*args, **kwargs):
Make a semilog plot with log scaling on the y axis. The args to
semilogy are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_yscale. Notable, for log scaling:
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- set_adjustable(self, adjustable)
- ACCEPTS: ['box' | 'datalim']
- set_anchor(self, anchor)
- ACCEPTS: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
- set_aspect(self, aspect, adjustable=None, anchor=None)
- aspect:
'auto' - automatic; fill position rectangle with data
'normal' - same as 'auto'; deprecated
'equal' - same scaling from data to plot units for x and y
num - a circle will be stretched such that the height
is num times the width. aspect=1 is the same as
aspect='equal'.
adjustable:
'box' - change physical size of axes
'datalim' - change xlim or ylim
anchor:
'C' - centered
'SW' - lower left corner
'S' - middle of bottom edge
'SE' - lower right corner
etc.
ACCEPTS: ['auto' | 'equal' | aspect_ratio]
- set_autoscale_on(self, b)
- Set whether autoscaling is applied on plot commands
ACCEPTS: True|False
- set_axis_bgcolor(self, color)
- set the axes background color
ACCEPTS: any matplotlib color - see help(colors)
- set_axis_off(self)
- turn off the axis
ACCEPTS: void
- set_axis_on(self)
- turn on the axis
ACCEPTS: void
- set_axisbelow(self, b)
- Set whether the axis ticks and gridlines are above or below most artists
ACCEPTS: True|False
- set_cursor_props(self, *args)
- Set the cursor property as
ax.set_cursor_props(linewidth, color) OR
ax.set_cursor_props((linewidth, color))
ACCEPTS: a (float, color) tuple
- set_figure(self, fig)
- Set the Axes figure
ACCEPTS: a Figure instance
- set_frame_on(self, b)
- Set whether the axes rectangle patch is drawn
ACCEPTS: True|False
- set_navigate(self, b)
- Set whether the axes responds to navigation toolbar commands
ACCEPTS: True|False
- set_navigate_mode(self, b)
- Set the navigation toolbar button status;
this is not a user-API function.
- set_position(self, pos, which='both')
- Set the axes position with pos = [left, bottom, width, height]
in relative 0,1 coords
There are two position variables: one which is ultimately
used, but which may be modified by apply_aspect, and a second
which is the starting point for apply_aspect.
which = 'active' to change the first;
'original' to change the second;
'both' to change both
ACCEPTS: len(4) sequence of floats
- set_title(self, label, fontdict=None, **kwargs)
- SET_TITLE(label, fontdict=None, **kwargs):
Set the title for the axes. See the text docstring for information
of how override and the optional args work
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: an agg.path_storage instance
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
ACCEPTS: str
- set_xbound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the x-axis.
This method will honor axes inversion regardless of parameter order.
- set_xscale(self, value, basex=10, subsx=None)
- SET_XSCALE(value, basex=10, subsx=None)
Set the xscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basex: base of the logarithm
* subsx: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsx=(1,2,5) will
put minor ticks on 1,2,5,11,12,15,21, ....To turn off
minor ticking, set subsx=[]
ACCEPTS: ['log' | 'linear' ]
- set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_xticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the xtick labels with list of strings labels Return a list of axis
text instances.
kwargs set the Text properties. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_xticks(self, ticks, minor=False)
- Set the x ticks with list of ticks
ACCEPTS: sequence of floats
- set_ybound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the y-axis.
This method will honor axes inversion regardless of parameter order.
- set_yscale(self, value, basey=10, subsy=None)
- SET_YSCALE(value, basey=10, subsy=None)
Set the yscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsy=(1,2,5) will
put minor ticks on 1,2,5,11,12,15, 21, ....To turn off
minor ticking, set subsy=[]
ACCEPTS: ['log' | 'linear']
- set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_yticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the ytick labels with list of strings labels. Return a list of
Text instances.
kwargs set Text properties for the labels. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_yticks(self, ticks, minor=False)
- Set the y ticks with list of ticks
ACCEPTS: sequence of floats
- sharex_foreign(self, axforeign)
- You can share your x-axis view limits with another Axes in the
same Figure by using the sharex and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the xaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- sharey_foreign(self, axforeign)
- You can share your y-axis view limits with another Axes in the
same Figure by using the sharey and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the yaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=128, cmap=None, xextent=None)
- SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window = mlab.window_hanning, noverlap=128,
cmap=None, xextent=None)
Compute a spectrogram of data in x. Data are split into NFFT length
segements and the PSD of each section is computed. The windowing
function window is applied to each segment, and the amount of overlap
of each segment is specified with noverlap.
* cmap is a colormap; if None use default determined by rc
* xextent is the image extent in the xaxes xextent=xmin, xmax -
default 0, max(bins), 0, max(freqs) where bins is the return
value from mlab.specgram
* See help(psd) for information on the other keyword arguments.
Return value is (Pxx, freqs, bins, im), where
bins are the time points the spectrogram is calculated over
freqs is an array of frequencies
Pxx is a len(times) x len(freqs) array of power
im is a image.AxesImage.
Note: If x is real (i.e. non-complex) only the positive spectrum is
shown. If x is complex both positive and negative parts of the
spectrum are shown.
- spy(self, Z, precision=None, marker=None, markersize=None, aspect='equal', **kwargs)
- spy(Z) plots the sparsity pattern of the 2-D array Z
If precision is None, any non-zero value will be plotted;
else, values of absolute(Z)>precision will be plotted.
The array will be plotted as it would be printed, with
the first index (row) increasing down and the second
index (column) increasing to the right.
By default aspect is 'equal' so that each array element
occupies a square space; set the aspect kwarg to 'auto'
to allow the plot to fill the plot box, or to any scalar
number to specify the aspect ratio of an array element
directly.
Two plotting styles are available: image or marker. Both
are available for full arrays, but only the marker style
works for scipy.sparse.spmatrix instances.
If marker and markersize are None, an image will be
returned and any remaining kwargs are passed to imshow;
else, a Line2D object will be returned with the value
of marker determining the marker type, and any remaining
kwargs passed to the axes plot method.
If marker and markersize are None, useful kwargs include:
cmap
alpha
See documentation for imshow() for details.
For controlling colors, e.g. cyan background and red marks, use:
cmap = mcolors.ListedColormap(['c','r'])
If marker or markersize is not None, useful kwargs include:
marker
markersize
color
See documentation for plot() for details.
Useful values for marker include:
's' square (default)
'o' circle
'.' point
',' pixel
- stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
- STEM(x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
A stem plot plots vertical lines (using linefmt) at each x location
from the baseline to y, and places a marker there using markerfmt. A
horizontal line at 0 is is plotted using basefmt
Return value is (markerline, stemlines, baseline) .
See
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html
for details and examples/stem_plot.py for a demo.
- step(self, x, y, *args, **kwargs)
- step(x, y, *args, **kwargs)
x and y must be 1-D sequences, and it is assumed, but not checked,
that x is uniformly increasing.
Make a step plot. The args and keyword args to step are the same
as the args to plot. See help plot for more info.
Additional keyword args for step:
* where: can be 'pre', 'post' or 'mid'; if 'pre', the
interval from x[i] to x[i+1] has level y[i];
if 'post', that interval has level y[i+1];
and if 'mid', the jumps in y occur half-way
between the x-values. Default is 'pre'.
- text(self, x, y, s, fontdict=None, withdash=False, **kwargs)
- TEXT(x, y, s, fontdict=None, **kwargs)
Add text in string s to axis at location x,y (data coords)
fontdict is a dictionary to override the default text properties.
If fontdict is None, the defaults are determined by your rc
parameters.
withdash=True will create a TextWithDash instance instead
of a Text instance.
Individual keyword arguments can be used to override any given
parameter
text(x, y, s, fontsize=12)
The default transform specifies that text is in data coords,
alternatively, you can specify text in axis coords (0,0 lower left and
1,1 upper right). The example below places text in the center of the
axes
text(0.5, 0.5,'matplotlib',
horizontalalignment='center',
verticalalignment='center',
transform = ax.transAxes,
)
You can put a rectangular box around the text instance (eg to
set a background color) by using the keyword bbox. bbox is a
dictionary of patches.Rectangle properties (see help
for Rectangle for a list of these). For example
text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
Valid 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: an agg.path_storage instance
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
- ticklabel_format(self, **kwargs)
- Convenience method for manipulating the ScalarFormatter
used by default for linear axes.
kwargs:
style = 'sci' (or 'scientific') or 'plain';
plain turns off scientific notation
axis = 'x', 'y', or 'both'
Only the major ticks are affected.
If the method is called when the ScalarFormatter is not
the one being used, an AttributeError will be raised with
no additional error message.
Additional capabilities and/or friendlier error checking may be added.
- twinx(self)
- ax = twinx()
create a twin of Axes for generating a plot with a sharex
x-axis but independent y axis. The y-axis of self will have
ticks on left and the returned axes will have ticks on the
right
- twiny(self)
- ax = twiny()
create a twin of Axes for generating a plot with a shared
y-axis but independent x axis. The x-axis of self will have
ticks on bottom and the returned axes will have ticks on the
top
- update_datalim(self, xys)
- Update the data lim bbox with seq of xy tups or equiv. 2-D array
- update_datalim_numerix(self, x, y)
- Update the data lim bbox with seq of xy tups
- vlines(self, x, ymin, ymax, colors='k', linestyle='solid', label='', **kwargs)
- VLINES(x, ymin, ymax, color='k')
Plot vertical lines at each x from ymin to ymax. ymin or ymax can be
scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the heights of the lines are
determined by ymin and ymax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the collections.LineCollection that was added
kwargs are collections.LineCollection properties:
alpha: float or sequence of floats
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
figure: a matplotlib.figure.Figure instance
label: any string
linestyle: ['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
segments: unknown
transform: a matplotlib.transform transformation instance
verts: unknown
visible: [True | False]
zorder: any number
- xaxis_date(self, tz=None)
- Sets up x-axis ticks and labels that treat the x data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- xaxis_inverted(self)
- Returns True if the x-axis is inverted.
- xcorr(self, x, y, normed=False, detrend=<function detrend_none at 0x868817c>, usevlines=False, maxlags=None, **kwargs)
- XCORR(x, y, normed=False, detrend=mlab.detrend_none, usevlines=False, **kwargs):
Plot the cross correlation between x and y. If normed=True,
normalize the data but the cross correlation at 0-th lag. x
and y are detrended by the detrend callable (default no
normalization. x and y must be equal length
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
- yaxis_date(self, tz=None)
- Sets up y-axis ticks and labels that treat the y data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- yaxis_inverted(self)
- Returns True if the y-axis is inverted.
Data and other attributes inherited from Axes:
- scaled = {0: 'linear', 1: 'log'}
Methods inherited from matplotlib.artist.Artist:
- add_callback(self, func)
- convert_xunits(self, x)
- for artists in an axes, if the xaxis as units support,
convert x using xaxis unit type
- convert_yunits(self, y)
- for artists in an axes, if the yaxis as units support,
convert y using yaxis unit type
- get_alpha(self)
- Return the alpha value used for blending - not supported on all
backends
- get_animated(self)
- return the artist's animated state
- get_axes(self)
- return the axes instance the artist resides in, or None
- get_clip_box(self)
- Return artist clipbox
- get_clip_on(self)
- Return whether artist uses clipping
- get_clip_path(self)
- Return artist clip path
- get_contains(self)
- return the _contains test used by the artist, or None for default.
- get_figure(self)
- return the figure instance
- get_label(self)
- get_picker(self)
- return the Pickeration instance used by this artist
- get_transform(self)
- return the Transformation instance used by this artist
- get_visible(self)
- return the artist's visiblity
- get_zorder(self)
- have_units(self)
- return True if units are set on the x or y axes
- hitlist(self, event)
- List the children of the artist which contain the mouse event
- is_figure_set(self)
- is_transform_set(self)
- Artist has transform explicity let
- pchanged(self)
- fire event when property changed
- pickable(self)
- return True if self is pickable
- remove(self)
- Remove the artist from the figure if possible. The effect will not
be visible until the figure is redrawn, e.g., with ax.draw_idle().
Call ax.relim() to update the axes limits if desired.
Note: relim() will not see collections even if the collection
was added to axes with autolim=True.
Note: there is no support for removing the artist's legend entry.
- remove_callback(self, oid)
- set(self, **kwargs)
- A tkstyle set command, pass kwargs to set properties
- set_alpha(self, alpha)
- Set the alpha value used for blending - not supported on
all backends
ACCEPTS: float
- set_animated(self, b)
- set the artist's animation state
ACCEPTS: [True | False]
- set_axes(self, axes)
- set the axes instance the artist resides in, if any
ACCEPTS: an axes instance
- set_clip_box(self, clipbox)
- Set the artist's clip Bbox
ACCEPTS: a matplotlib.transform.Bbox instance
- set_clip_on(self, b)
- Set whether artist uses clipping
ACCEPTS: [True | False]
- set_clip_path(self, path)
- Set the artist's clip path
ACCEPTS: an agg.path_storage instance
- set_contains(self, picker)
- Replace the contains test used by this artist. The new picker should
be a callable function which determines whether the artist is hit by the
mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit=True and props
is a dictionary of properties you want returned with the contains test.
- set_label(self, s)
- Set the line label to s for auto legend
ACCEPTS: any string
- set_lod(self, on)
- Set Level of Detail on or off. If on, the artists may examine
things like the pixel width of the axes and draw a subset of
their contents accordingly
ACCEPTS: [True | False]
- set_picker(self, picker)
- set the epsilon for picking used by this artist
picker can be one of the following:
None - picking is disabled for this artist (default)
boolean - if True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist
float - if picker is a number it is interpreted as an
epsilon tolerance in points and the the artist will fire
off an event if it's data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, eg the indices of the data within
epsilon of the pick event
function - if picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event.
hit, props = picker(artist, mouseevent)
to determine the hit test. if the mouse event is over the
artist, return hit=True and props is a dictionary of
properties you want added to the PickEvent attributes
ACCEPTS: [None|float|boolean|callable]
- set_transform(self, t)
- set the Transformation instance used by this artist
ACCEPTS: a matplotlib.transform transformation instance
- set_visible(self, b)
- set the artist's visiblity
ACCEPTS: [True | False]
- set_zorder(self, level)
- Set the zorder for the artist
ACCEPTS: any number
- update(self, props)
- update_from(self, other)
- copy properties from other to self
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
- zorder = 0
|
class PolarSubplot(SubplotBase, PolarAxes) |
|
subplot class for Polar Axes
This is not normally instantiated by the user; instead,
use the Figure.add_subplot(..., polar=True) method. |
|
- Method resolution order:
- PolarSubplot
- SubplotBase
- PolarAxes
- Axes
- matplotlib.artist.Artist
Methods defined here:
- __init__(self, fig, *args, **kwargs)
- __str__(self)
Methods inherited from SubplotBase:
- change_geometry(self, numrows, numcols, num)
- change subplot geometry, eg from 1,1,1 to 2,2,3
- get_geometry(self)
- get the subplot geometry, eg 2,2,3
- is_first_col(self)
- is_first_row(self)
- is_last_col(self)
- is_last_row(self)
- label_outer(self)
- set the visible property on ticklabels so xticklabels are
visible only if the subplot is in the last row and yticklabels
are visible only if the subplot is in the first column
- update_params(self)
- update the subplot position from fig.subplotpars
Methods inherited from PolarAxes:
- autoscale_view(self, scalex=True, scaley=True)
- set the view limits to include all the data in the axes
- cla(self)
- Clear the current axes
- contains(self, mouseevent)
- Test whether the mouse event occured in the axes.
Returns T/F, {}
- draw(self, renderer)
- format_coord(self, theta, r)
- return a format string formatting the coordinate
- get_children(self)
- return a list of child artists
- get_rmax(self)
- get the maximum radius in the view limits dimension
- get_xscale(self)
- return the xaxis scale string
- get_yscale(self)
- return the yaxis scale string
- grid(self, b)
- Set the axes grids on or off; b is a boolean
- has_data(self)
- return true if any artists have been added to axes
- regrid(self, rmax)
- set_rgrids(self, radii, labels=None, angle=22.5, rpad=0.050000000000000003, **kwargs)
- set the radial locations and labels of the r grids
The labels will appear at radial distances radii at angle
labels, if not None, is a len(radii) list of strings of the
labels to use at each angle.
if labels is None, the self.rformatter will be used
rpad is a fraction of the max of radii which will pad each of
the radial labels in the radial direction.
Return value is a list of lines, labels where the lines are
lines.Line2D instances and the labels are text.Text
instances
kwargs control the rgrid Text label 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: an agg.path_storage instance
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
ACCEPTS: sequence of floats
- set_rmax(self, rmax)
- set_thetagrids(self, angles, labels=None, fmt='%d', frac=1.1000000000000001, **kwargs)
- set the angles at which to place the theta grids (these
gridlines are equal along the theta dimension). angles is in
degrees
labels, if not None, is a len(angles) list of strings of the
labels to use at each angle.
if labels is None, the labels with be fmt%angle
frac is the fraction of the polar axes radius at which to
place the label (1 is the edge).Eg 1.05 isd outside the axes
and 0.95 is inside the axes
Return value is a list of lines, labels where the lines are
lines.Line2D instances and the labels are Text
instances:
kwargs are optional text properties for the labels
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: an agg.path_storage instance
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
ACCEPTS: sequence of floats
- set_xlabel(self, xlabel, fontdict=None, **kwargs)
- xlabel not implemented
- set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs)
- xlim not implemented
- set_ylabel(self, ylabel, fontdict=None, **kwargs)
- ylabel not implemented
- set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs)
- ylim not implemented
- table(self, *args, **kwargs)
- TABLE(*args, **kwargs)
Not implemented for polar axes
- toggle_log_lineary(self)
- toggle between log and linear axes ignored for polar
Data and other attributes inherited from PolarAxes:
- RESOLUTION = 100
Methods inherited from Axes:
- acorr(self, x, **kwargs)
- 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=False)
- 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)
- 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
- 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.
'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: an agg.path_storage instance
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, data_ratio=None)
- Use self._aspect and self._adjustable to modify the
axes box or the view limits.
The data_ratio kwarg is set to 1 for polar axes. It is
used only when _adjustable is 'box'.
- 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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
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'
- 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 0x868817c>, window=<function window_hanning at 0x868802c>, 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
- 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 0x868817c>, window=<function window_hanning at 0x868802c>, 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*npy.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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- disconnect(self, cid)
- disconnect from the Axes event.
- 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)
- errorbar(self, x, y, yerr=None, xerr=None, fmt='-', ecolor=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, 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.
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- 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_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_cursor_props(self)
- return the cursor props as a linewidth, color tuple where
linewidth is a float and color is an RGBA tuple
- 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 axes rectangle left, bottom, width, height
- get_renderer_cache(self)
- 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_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_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_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_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_ylim(self)
- Get the y axis range [ymin, ymax]
- 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_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
- hist(self, x, bins=10, normed=0, bottom=None, align='edge', orientation='vertical', width=None, log=False, **kwargs)
- HIST(x, bins=10, normed=0, bottom=None,
align='edge', orientation='vertical', width=None,
log=False, **kwargs)
Compute the histogram of x. bins is either an integer number of
bins or a sequence giving the bins. x are the data to be binned.
The return values is (n, bins, patches)
If normed is true, the first element of the return tuple will
be the counts normalized to form a probability density, ie,
n/(len(x)*dbin). In a probability density, the integral of
the histogram should be one (we assume equally spaced bins);
you can verify that with
# trapezoidal integration of the probability density function
pdf, bins, patches = ax.hist(...)
print npy.trapz(pdf, bins)
align = 'edge' | 'center'. Interprets bins either as edge
or center values
orientation = 'horizontal' | 'vertical'. If horizontal, barh
will be used and the "bottom" kwarg will be the left edges.
width: the width of the bars. If None, automatically compute
the width.
log: if True, the histogram axis will be set to a log scale
kwargs are used to update the properties of the
hist Rectangles:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- hlines(self, y, xmin, xmax, colors='k', linestyle='solid', label='', **kwargs)
- HLINES(y, xmin, xmax, colors='k', linestyle='solid', **kwargs)
plot horizontal lines at each y from xmin to xmax. xmin or xmax can
be scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the widths of the lines are
determined by xmin and xmax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the LineCollection that was added
- hold(self, b=None)
- HOLD(b=None)
Set the hold state. If hold is None (default), toggle the
hold state. Else set the hold state to boolean value b.
Eg
hold() # toggle hold
hold(True) # hold is on
hold(False) # hold is off
When hold is True, subsequent plot commands will be added to
the current axes. When hold is False, the current axes and
figure will be cleared on the next plot command
- imshow(self, X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=1.0, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, **kwargs)
- IMSHOW(X, cmap=None, norm=None, aspect=None, interpolation=None,
alpha=1.0, vmin=None, vmax=None, origin=None, extent=None)
IMSHOW(X) - plot image X to current axes, resampling to scale to axes
size (X may be numpy array or PIL image)
IMSHOW(X, **kwargs) - Use keyword args to control image scaling,
colormapping etc. See below for details
Display the image in X to current axes. X may be a float array, a
uint8 array or a PIL image. If X is an array, X can have the following
shapes:
MxN : luminance (grayscale, float array only)
MxNx3 : RGB (float or uint8 array)
MxNx4 : RGBA (float or uint8 array)
The value for each component of MxNx3 and MxNx4 float arrays should be
in the range 0.0 to 1.0; MxN float arrays may be normalised.
A image.AxesImage instance is returned
The following kwargs are allowed:
* cmap is a cm colormap instance, eg cm.jet. If None, default to rc
image.cmap value (Ignored when X has RGB(A) information)
* aspect is one of: auto, equal, or a number. If None, default to rc
image.aspect value
* interpolation is one of:
'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
'lanczos', 'blackman'
if interpolation is None, default to rc
image.interpolation. See also th the filternorm and
filterrad parameters
* norm is a mcolors.Normalize instance; default is
normalization(). This scales luminance -> 0-1 (only used for an
MxN float array).
* vmin and vmax are used to scale a luminance image to 0-1. If
either is None, the min and max of the luminance values will be
used. Note if you pass a norm instance, the settings for vmin and
vmax will be ignored.
* alpha = 1.0 : the alpha blending value
* origin is 'upper' or 'lower', to place the [0,0]
index of the array in the upper left or lower left corner of
the axes. If None, default to rc image.origin
* extent is (left, right, bottom, top) data values of the
axes. The default assigns zero-based row, column indices
to the x, y centers of the pixels.
* shape is for raw buffer images
* filternorm is a parameter for the antigrain image resize
filter. From the antigrain documentation, if normalize=1,
the filter normalizes integer values and corrects the
rounding errors. It doesn't do anything with the source
floating point values, it corrects only integers according
to the rule of 1.0 which means that any sum of pixel
weights must be equal to 1.0. So, the filter function
must produce a graph of the proper shape.
* filterrad: the filter radius for filters that have a radius
parameter, ie when interpolation is one of: 'sinc',
'lanczos' or 'blackman'
Additional kwargs are martist properties
- in_axes(self, xwin, ywin)
- return True is the point xwin, ywin (display coords) are in the Axes
- invert_xaxis(self)
- Invert the x-axis.
- invert_yaxis(self)
- Invert the y-axis.
- ishold(self)
- return the HOLD status of the axes
- legend(self, *args, **kwargs)
- LEGEND(*args, **kwargs)
Place a legend on the current axes at location loc. Labels are a
sequence of strings and loc can be a string or an integer specifying
the legend location
USAGE:
Make a legend with existing lines
>>> legend()
legend by itself will try and build a legend using the label
property of the lines/patches/collections. You can set the label of
a line by doing plot(x, y, label='my data') or line.set_label('my
data'). If label is set to '_nolegend_', the item will not be shown
in legend.
# automatically generate the legend from labels
legend( ('label1', 'label2', 'label3') )
# Make a legend for a list of lines and labels
legend( (line1, line2, line3), ('label1', 'label2', 'label3') )
# Make a legend at a given location, using a location argument
# legend( LABELS, LOC ) or
# legend( LINES, LABELS, LOC )
legend( ('label1', 'label2', 'label3'), loc='upper left')
legend( (line1, line2, line3), ('label1', 'label2', 'label3'), loc=2)
The location codes are
'best' : 0,
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right' : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center' : 10,
If none of these are suitable, loc can be a 2-tuple giving x,y
in axes coords, ie,
loc = 0, 1 is left top
loc = 0.5, 0.5 is center, center
and so on. The following kwargs are supported:
isaxes=True # whether this is an axes legend
numpoints = 4 # the number of points in the legend line
prop = FontProperties(size='smaller') # the font property
pad = 0.2 # the fractional whitespace inside the legend border
markerscale = 0.6 # the relative size of legend markers vs. original
shadow # if True, draw a shadow behind legend
labelsep = 0.005 # the vertical space between the legend entries
handlelen = 0.05 # the length of the legend lines
handletextsep = 0.02 # the space between the legend line and legend text
axespad = 0.02 # the border between the axes and legend edge
- loglog(self, *args, **kwargs)
- LOGLOG(*args, **kwargs)
Make a loglog plot with log scaling on the a and y axis. The args
to semilog x are the same as the args to plot. See help plot for
more info.
Optional keyword args supported are any of the kwargs
supported by plot or set_xscale or set_yscale. Notable, for
log scaling:
* basex: base of the x logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
* basey: base of the y logarithm
* subsy: the location of the minor yticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- matshow(self, Z, **kwargs)
- Plot a matrix as an image.
The matrix will be shown the way it would be printed,
with the first row at the top. Row and column numbering
is zero-based.
Argument:
Z anything that can be interpreted as a 2-D array
kwargs: all are passed to imshow. matshow sets defaults
for extent, origin, interpolation, and aspect; use care
in overriding the extent and origin kwargs, because they
interact. (Also, if you want to change them, you probably
should be using imshow directly in your own version of
matshow.)
Returns: an image.AxesImage instance
- pcolor(self, *args, **kwargs)
- pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the array of color values
X and Y, if given, specify the (x,y) coordinates of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). Ideally the dimensions of X and Y
should be one greater than those of C; if the dimensions are the
same, then the last row and column of C will be ignored.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
If either or both of X and Y are 1-D arrays or column vectors,
they will be expanded as needed into the appropriate 2-D arrays,
making a rectangular grid.
X,Y and C may be masked arrays. If either C[i,j], or one
of the vertices surrounding C[i,j] (X or Y at [i,j],[i+1,j],
[i,j+1],[i=1,j+1]) is masked, nothing is plotted.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
edgecolors can also be None to specify the rcParams
default, or any mpl color or sequence of colors.
* alpha=1.0 : the alpha blending value
Return value is a mcoll.PatchCollection
object
Grid Orientation
The orientation follows the Matlab(TM) convention: an
array C with shape (nrows, ncolumns) is plotted with
the column number as X and the row number as Y, increasing
up; hence it is plotted the way the array would be printed,
except that the Y axis is reversed. That is, C is taken
as C(y,x).
Similarly for meshgrid:
x = npy.arange(5)
y = npy.arange(3)
X, Y = meshgrid(x,y)
is equivalent to
X = array([[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]])
Y = array([[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[2, 2, 2, 2, 2]])
so if you have
C = rand( len(x), len(y))
then you need
pcolor(X, Y, C.T)
or
pcolor(C.T)
Dimensions
Matlab pcolor always discards
the last row and column of C, but matplotlib displays
the last row and column if X and Y are not specified, or
if X and Y have one more row and column than C.
kwargs can be used to control the PolyCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pcolorfast(self, *args, **kwargs)
- Experimental; this is a version of pcolor that
does not draw lines, that provides the fastest
possible rendering with the Agg backend, and that
can handle any quadrilateral grid.
pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(xr, yr, C, **kwargs)
pcolor(x, y, C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the 2D array of color values corresponding to quadrilateral
cells. Let (nr, nc) be its shape. C may be a masked array.
pcolor(C, **kwargs) is equivalent to
pcolor([0,nc], [0,nr], C, **kwargs)
xr, yr specify the ranges of x and y corresponding to the rectangular
region bounding C. If xr = [x0, x1] and yr = [y0,y1] then
x goes from x0 to x1 as the second index of C goes from 0 to nc,
etc. (x0, y0) is the outermost corner of cell (0,0), and (x1, y1)
is the outermost corner of cell (nr-1, nc-1). All cells are
rectangles of the same size. This is the fastest version.
x, y are 1D arrays of length nc+1 and nr+1, respectively, giving
the x and y boundaries of the cells. Hence the cells are
rectangular but the grid may be nonuniform. The speed is
intermediate. (The grid is checked, and if found to be
uniform the fast version is used.)
X and Y are 2D arrays with shape (nr+1, nc+1) that specify
the (x,y) coordinates of the corners of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). The cells need not be rectangular.
This is the most general, but the slowest to render. It may
produce faster and more compact output using ps, pdf, and
svg backends, however.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* alpha=1.0 : the alpha blending value
Return value is an image if a regular or rectangular grid
is specified, and a QuadMesh collection in the general
quadrilateral case.
- pcolormesh(self, *args, **kwargs)
- PCOLORMESH(*args, **kwargs)
Function signatures
PCOLORMESH(C) - make a pseudocolor plot of matrix C
PCOLORMESH(X, Y, C) - a pseudo color plot of C on the matrices X and Y
PCOLORMESH(C, **kwargs) - Use keyword args to control colormapping and
scaling; see below
C may be a masked array, but X and Y may not. Masked array support
is implemented via cmap and norm; in contrast, pcolor simply does
not draw quadrilaterals with masked colors or vertices.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm.
* norm = Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1. Instantiate it
with clip=False if C is a masked array.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used.
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
More flexible specification of edgecolors, as in pcolor,
is not presently supported.
* alpha=1.0 : the alpha blending value
Return value is a collections.PatchCollection
object
See pcolor for an explantion of the grid orientation and the
expansion of 1-D X and/or Y to 2-D arrays.
kwargs can be used to control the collections.QuadMesh polygon
collection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pick(self, *args)
- pick(mouseevent)
each child artist will fire a pick event if mouseevent is over
the artist and the artist has picker set
- pie(self, x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.59999999999999998, shadow=False, labeldistance=1.1000000000000001)
- PIE(x, explode=None, labels=None,
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
autopct=None, pctdistance=0.6, labeldistance=1.1, shadow=False)
Make a pie chart of array x. The fractional area of each wedge is
given by x/sum(x). If sum(x)<=1, then the values of x give the
fractional area directly and the array will not be normalized.
- explode, if not None, is a len(x) array which specifies the
fraction of the radius to offset that wedge.
- colors is a sequence of matplotlib color args that the pie chart
will cycle.
- labels, if not None, is a len(x) list of labels.
- autopct, if not None, is a string or function used to label the
wedges with their numeric value. The label will be placed inside
the wedge. If it is a format string, the label will be fmt%pct.
If it is a function, it will be called
- pctdistance is the ratio between the center of each pie slice
and the start of the text generated by autopct. Ignored if autopct
is None; default is 0.6.
- labeldistance is the radial distance at which the pie labels are drawn
- shadow, if True, will draw a shadow beneath the pie.
The pie chart will probably look best if the figure and axes are
square. Eg,
figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])
Return value:
If autopct is None, return a list of (patches, texts), where patches
is a sequence of mpatches.Wedge instances and texts is a
list of the label Text instnaces
If autopct is not None, return (patches, texts, autotexts), where
patches and texts are as above, and autotexts is a list of text
instances for the numeric labels
- plot(self, *args, **kwargs)
- PLOT(*args, **kwargs)
Plot lines and/or markers to the Axes. *args is a variable length
argument, allowing for multiple x,y pairs with an optional format
string. For example, each of the following is legal
plot(x,y) # plot x and y using the default line style and color
plot(x,y, 'bo') # plot x and y using blue circle markers
plot(y) # plot y using x as index array 0..N-1
plot(y, 'r+') # ditto, but with red plusses
If x and/or y is 2-Dimensional, then the corresponding columns
will be plotted.
An arbitrary number of x, y, fmt groups can be specified, as in
a.plot(x1, y1, 'g^', x2, y2, 'g-')
Return value is a list of lines that were added.
The following line styles are supported:
- : solid line
-- : dashed line
-. : dash-dot line
: : dotted line
. : points
, : pixels
o : circle symbols
^ : triangle up symbols
v : triangle down symbols
< : triangle left symbols
> : triangle right symbols
s : square symbols
+ : plus symbols
x : cross symbols
D : diamond symbols
d : thin diamond symbols
1 : tripod down symbols
2 : tripod up symbols
3 : tripod left symbols
4 : tripod right symbols
h : hexagon symbols
H : rotated hexagon symbols
p : pentagon symbols
| : vertical line symbols
_ : horizontal line symbols
steps : use gnuplot style 'steps' # kwarg only
The following color abbreviations are supported
b : blue
g : green
r : red
c : cyan
m : magenta
y : yellow
k : black
w : white
In addition, you can specify colors in many weird and
wonderful ways, including full names 'green', hex strings
'#008000', RGB or RGBA tuples (0,1,0,1) or grayscale
intensities as a string '0.8'. Of these, the string
specifications can be used in place of a fmt group, but the
tuple forms can be used only as kwargs.
Line styles and colors are combined in a single format string, as in
'bo' for blue circles.
The **kwargs can be used to set line properties (any property that has
a set_* method). You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc. Here is an
example:
plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
plot([1,2,3], [1,4,9], 'rs', label='line 2')
axis([0, 4, 0, 10])
legend()
If you make multiple lines with one plot command, the kwargs apply
to all those lines, eg
plot(x1, y1, x2, y2, antialised=False)
Neither line will be antialiased.
The 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
kwargs scalex and scaley, if defined, are passed on
to autoscale_view to determine whether the x and y axes are
autoscaled; default True. See Axes.autoscale_view for more
information
- plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
- PLOT_DATE(x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
Similar to the plot() command, except the x or y (or both) data
is considered to be dates, and the axis is labeled accordingly.
x or y (or both) can be a sequence of dates represented as
float days since 0001-01-01 UTC.
fmt is a plot format string.
tz is the time zone to use in labelling dates. Defaults to rc value.
If xdate is True, the x-axis will be labeled with dates.
If ydate is True, the y-axis will be labeled with dates.
Note if you are using custom date tickers and formatters, it
may be necessary to set the formatters/locators after the call
to plot_date since plot_date will set the default tick locator
to ticker.AutoDateLocator (if the tick locator is not already set to
a ticker.DateLocator instance) and the default tick formatter to
AutoDateFormatter (if the tick formatter is not already set to
a DateFormatter instance).
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
See dates for helper functions date2num, num2date
and drange for help on creating the required floating point dates
- psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=0, **kwargs)
- PSD(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=0, **kwargs)
The power spectral density by Welches average periodogram method. The
vector x is divided into NFFT length segments. Each segment is
detrended by function detrend and windowed by function window.
noperlap gives the length of the overlap between segments. The
absolute(fft(segment))**2 of each segment are averaged to compute Pxx,
with a scaling to correct for power loss due to windowing. Fs is the
sampling frequency.
* NFFT is the length of the fft segment; must be a power of 2
* Fs is the sampling frequency.
* Fc is the center frequency of x (defaults to 0), which offsets
the yextents of the image to reflect the frequency range used
when a signal is acquired and then filtered and downsampled to
baseband.
* detrend - the function applied to each segment before fft-ing,
designed to remove the mean or linear trend. Unlike in matlab,
where the detrend parameter is a vector, in matplotlib is it a
function. The mlab module defines detrend_none, detrend_mean,
detrend_linear, but you can use a custom function as well.
* window - the function used to window the segments. window is a
function, unlike in matlab(TM) where it is a vector. mlab defines
window_none, window_hanning, but you can use a custom function
as well.
* noverlap gives the length of the overlap between segments.
Returns the tuple Pxx, freqs
For plotting, the power is plotted as 10*npy.log10(pxx) for decibels,
though pxx itself is returned
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- quiver(self, *args, **kw)
- Plot a 2-D field of arrows.
Function signatures:
quiver(U, V, **kw)
quiver(U, V, C, **kw)
quiver(X, Y, U, V, **kw)
quiver(X, Y, U, V, C, **kw)
Arguments:
X, Y give the x and y coordinates of the arrow locations
(default is tail of arrow; see 'pivot' kwarg)
U, V give the x and y components of the arrow vectors
C is an optional array used to map colors to the arrows
All arguments may be 1-D or 2-D arrays or sequences.
If X and Y are absent, they will be generated as a uniform grid.
If U and V are 2-D arrays but X and Y are 1-D, and if
len(X) and len(Y) match the column and row dimensions
of U, then X and Y will be expanded with meshgrid.
U, V, C may be masked arrays, but masked X, Y are not
supported at present.
Keyword arguments (default given first):
* units = 'width' | 'height' | 'dots' | 'inches' | 'x' | 'y'
arrow units; the arrow dimensions *except for length*
are in multiples of this unit.
* scale = None | float
data units per arrow unit, e.g. m/s per plot width;
a smaller scale parameter makes the arrow longer.
If None, a simple autoscaling algorithm is used, based
on the average vector length and the number of vectors.
Arrow dimensions and scales can be in any of several units:
'width' or 'height': the width or height of the axes
'dots' or 'inches': pixels or inches, based on the figure dpi
'x' or 'y': X or Y data units
In all cases the arrow aspect ratio is 1, so that if U==V the angle
of the arrow on the plot is 45 degrees CCW from the X-axis.
The arrows scale differently depending on the units, however.
For 'x' or 'y', the arrows get larger as one zooms in; for other
units, the arrow size is independent of the zoom state. For
'width or 'height', the arrow size increases with the width and
height of the axes, respectively, when the the window is resized;
for 'dots' or 'inches', resizing does not change the arrows.
* width = ? shaft width in arrow units; default depends on
choice of units, above, and number of vectors;
a typical starting value is about
0.005 times the width of the plot.
* headwidth = 3 head width as multiple of shaft width
* headlength = 5 head length as multiple of shaft width
* headaxislength = 4.5 head length at shaft intersection
* minshaft = 1 length below which arrow scales, in units
of head length. Do not set this to less
than 1, or small arrows will look terrible!
* minlength = 1 minimum length as a multiple of shaft width;
if an arrow length is less than this, plot a
dot (hexagon) of this diameter instead.
The defaults give a slightly swept-back arrow; to make the
head a triangle, make headaxislength the same as headlength.
To make the arrow more pointed, reduce headwidth or increase
headlength and headaxislength.
To make the head smaller relative to the shaft, scale down
all the head* parameters.
You will probably do best to leave minshaft alone.
* pivot = 'tail' | 'middle' | 'tip'
The part of the arrow that is at the grid point; the arrow
rotates about this point, hence the name 'pivot'.
* color = 'k' | any matplotlib color spec or sequence of color specs.
This is a synonym for the PolyCollection facecolor kwarg.
If C has been set, 'color' has no effect.
* All PolyCollection kwargs are valid, in the sense that they
will be passed on to the PolyCollection constructor.
In particular, one might want to use, for example:
linewidths = (1,), edgecolors = ('g',)
to make the arrows have green outlines of unit width.
- quiverkey(self, *args, **kw)
- Add a key to a quiver plot.
Function signature:
quiverkey(Q, X, Y, U, label, **kw)
Arguments:
Q is the Quiver instance returned by a call to quiver.
X, Y give the location of the key; additional explanation follows.
U is the length of the key
label is a string with the length and units of the key
Keyword arguments (default given first):
* coordinates = 'axes' | 'figure' | 'data' | 'inches'
Coordinate system and units for X, Y: 'axes' and 'figure'
are normalized coordinate systems with 0,0 in the lower
left and 1,1 in the upper right; 'data' are the axes
data coordinates (used for the locations of the vectors
in the quiver plot itself); 'inches' is position in the
figure in inches, with 0,0 at the lower left corner.
* color overrides face and edge colors from Q.
* labelpos = 'N' | 'S' | 'E' | 'W'
Position the label above, below, to the right, to the left
of the arrow, respectively.
* labelsep = 0.1 inches distance between the arrow and the label
* labelcolor (defaults to default Text color)
* fontproperties is a dictionary with keyword arguments accepted
by the FontProperties initializer: family, style, variant,
size, weight
Any additional keyword arguments are used to override vector
properties taken from Q.
The positioning of the key depends on X, Y, coordinates, and
labelpos. If labelpos is 'N' or 'S', X,Y give the position
of the middle of the key arrow. If labelpos is 'E', X,Y
positions the head, and if labelpos is 'W', X,Y positions the
tail; in either of these two cases, X,Y is somewhere in the middle
of the arrow+label key object.
- redraw_in_frame(self)
- 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)
- relim(self)
- recompute the datalimits based on current artists
- scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, faceted=True, verts=None, **kwargs)
- SCATTER(x, y, s=20, c='b', marker='o', cmap=None, norm=None,
vmin=None, vmax=None, alpha=1.0, linewidths=None,
faceted=True, **kwargs)
Supported function signatures:
SCATTER(x, y, **kwargs)
SCATTER(x, y, s, **kwargs)
SCATTER(x, y, s, c, **kwargs)
Make a scatter plot of x versus y, where x, y are 1-D sequences
of the same length, N.
Arguments s and c can also be given as kwargs; this is encouraged
for readability.
s is a size in points^2. It is a scalar
or an array of the same length as x and y.
c is a color and can be a single color format string,
or a sequence of color specifications of length N,
or a sequence of N numbers to be mapped to colors
using the cmap and norm specified via kwargs (see below).
Note that c should not be a single numeric RGB or RGBA
sequence because that is indistinguishable from an array
of values to be colormapped. c can be a 2-D array in which
the rows are RGB or RGBA, however.
The marker can be one of
's' : square
'o' : circle
'^' : triangle up
'>' : triangle right
'v' : triangle down
'<' : triangle left
'd' : diamond
'p' : pentagram
'h' : hexagon
'8' : octagon
If marker is None and verts is not None, verts is a sequence
of (x,y) vertices for a custom scatter symbol.
s is a size argument in points squared.
Any or all of x, y, s, and c may be masked arrays, in which
case all masks will be combined and only unmasked points
will be plotted.
Other keyword args; the color mapping and normalization arguments will
be used only if c is an array of floats
* cmap = cm.jet : a colors.Colormap instance from cm.
defaults to rc image.cmap
* norm = colors.Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. Note if you pass a norm
instance, your settings for vmin and vmax will be ignored
* alpha =1.0 : the alpha value for the patches
* linewidths, if None, defaults to (lines.linewidth,). Note
that this is a tuple, and if you set the linewidths
argument you must set it as a sequence of floats, as
required by RegularPolyCollection -- see
collections.RegularPolyCollection for details
* faceted: if True, will use the default edgecolor for the
markers. If False, will set the edgecolors to be the same
as the facecolors.
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors=None
edgecolors also can be any mpl color or sequence of colors.
Optional kwargs control the PatchCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
A Collection instance is returned
- semilogx(self, *args, **kwargs)
- SEMILOGX(*args, **kwargs)
Make a semilog plot with log scaling on the x axis. The args to
semilog x are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_xscale. Notable, for log scaling:
* basex: base of the logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- semilogy(self, *args, **kwargs)
- SEMILOGY(*args, **kwargs):
Make a semilog plot with log scaling on the y axis. The args to
semilogy are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_yscale. Notable, for log scaling:
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- set_adjustable(self, adjustable)
- ACCEPTS: ['box' | 'datalim']
- set_anchor(self, anchor)
- ACCEPTS: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
- set_aspect(self, aspect, adjustable=None, anchor=None)
- aspect:
'auto' - automatic; fill position rectangle with data
'normal' - same as 'auto'; deprecated
'equal' - same scaling from data to plot units for x and y
num - a circle will be stretched such that the height
is num times the width. aspect=1 is the same as
aspect='equal'.
adjustable:
'box' - change physical size of axes
'datalim' - change xlim or ylim
anchor:
'C' - centered
'SW' - lower left corner
'S' - middle of bottom edge
'SE' - lower right corner
etc.
ACCEPTS: ['auto' | 'equal' | aspect_ratio]
- set_autoscale_on(self, b)
- Set whether autoscaling is applied on plot commands
ACCEPTS: True|False
- set_axis_bgcolor(self, color)
- set the axes background color
ACCEPTS: any matplotlib color - see help(colors)
- set_axis_off(self)
- turn off the axis
ACCEPTS: void
- set_axis_on(self)
- turn on the axis
ACCEPTS: void
- set_axisbelow(self, b)
- Set whether the axis ticks and gridlines are above or below most artists
ACCEPTS: True|False
- set_cursor_props(self, *args)
- Set the cursor property as
ax.set_cursor_props(linewidth, color) OR
ax.set_cursor_props((linewidth, color))
ACCEPTS: a (float, color) tuple
- set_figure(self, fig)
- Set the Axes figure
ACCEPTS: a Figure instance
- set_frame_on(self, b)
- Set whether the axes rectangle patch is drawn
ACCEPTS: True|False
- set_navigate(self, b)
- Set whether the axes responds to navigation toolbar commands
ACCEPTS: True|False
- set_navigate_mode(self, b)
- Set the navigation toolbar button status;
this is not a user-API function.
- set_position(self, pos, which='both')
- Set the axes position with pos = [left, bottom, width, height]
in relative 0,1 coords
There are two position variables: one which is ultimately
used, but which may be modified by apply_aspect, and a second
which is the starting point for apply_aspect.
which = 'active' to change the first;
'original' to change the second;
'both' to change both
ACCEPTS: len(4) sequence of floats
- set_title(self, label, fontdict=None, **kwargs)
- SET_TITLE(label, fontdict=None, **kwargs):
Set the title for the axes. See the text docstring for information
of how override and the optional args work
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: an agg.path_storage instance
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
ACCEPTS: str
- set_xbound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the x-axis.
This method will honor axes inversion regardless of parameter order.
- set_xscale(self, value, basex=10, subsx=None)
- SET_XSCALE(value, basex=10, subsx=None)
Set the xscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basex: base of the logarithm
* subsx: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsx=(1,2,5) will
put minor ticks on 1,2,5,11,12,15,21, ....To turn off
minor ticking, set subsx=[]
ACCEPTS: ['log' | 'linear' ]
- set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_xticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the xtick labels with list of strings labels Return a list of axis
text instances.
kwargs set the Text properties. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_xticks(self, ticks, minor=False)
- Set the x ticks with list of ticks
ACCEPTS: sequence of floats
- set_ybound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the y-axis.
This method will honor axes inversion regardless of parameter order.
- set_yscale(self, value, basey=10, subsy=None)
- SET_YSCALE(value, basey=10, subsy=None)
Set the yscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsy=(1,2,5) will
put minor ticks on 1,2,5,11,12,15, 21, ....To turn off
minor ticking, set subsy=[]
ACCEPTS: ['log' | 'linear']
- set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_yticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the ytick labels with list of strings labels. Return a list of
Text instances.
kwargs set Text properties for the labels. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_yticks(self, ticks, minor=False)
- Set the y ticks with list of ticks
ACCEPTS: sequence of floats
- sharex_foreign(self, axforeign)
- You can share your x-axis view limits with another Axes in the
same Figure by using the sharex and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the xaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- sharey_foreign(self, axforeign)
- You can share your y-axis view limits with another Axes in the
same Figure by using the sharey and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the yaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=128, cmap=None, xextent=None)
- SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window = mlab.window_hanning, noverlap=128,
cmap=None, xextent=None)
Compute a spectrogram of data in x. Data are split into NFFT length
segements and the PSD of each section is computed. The windowing
function window is applied to each segment, and the amount of overlap
of each segment is specified with noverlap.
* cmap is a colormap; if None use default determined by rc
* xextent is the image extent in the xaxes xextent=xmin, xmax -
default 0, max(bins), 0, max(freqs) where bins is the return
value from mlab.specgram
* See help(psd) for information on the other keyword arguments.
Return value is (Pxx, freqs, bins, im), where
bins are the time points the spectrogram is calculated over
freqs is an array of frequencies
Pxx is a len(times) x len(freqs) array of power
im is a image.AxesImage.
Note: If x is real (i.e. non-complex) only the positive spectrum is
shown. If x is complex both positive and negative parts of the
spectrum are shown.
- spy(self, Z, precision=None, marker=None, markersize=None, aspect='equal', **kwargs)
- spy(Z) plots the sparsity pattern of the 2-D array Z
If precision is None, any non-zero value will be plotted;
else, values of absolute(Z)>precision will be plotted.
The array will be plotted as it would be printed, with
the first index (row) increasing down and the second
index (column) increasing to the right.
By default aspect is 'equal' so that each array element
occupies a square space; set the aspect kwarg to 'auto'
to allow the plot to fill the plot box, or to any scalar
number to specify the aspect ratio of an array element
directly.
Two plotting styles are available: image or marker. Both
are available for full arrays, but only the marker style
works for scipy.sparse.spmatrix instances.
If marker and markersize are None, an image will be
returned and any remaining kwargs are passed to imshow;
else, a Line2D object will be returned with the value
of marker determining the marker type, and any remaining
kwargs passed to the axes plot method.
If marker and markersize are None, useful kwargs include:
cmap
alpha
See documentation for imshow() for details.
For controlling colors, e.g. cyan background and red marks, use:
cmap = mcolors.ListedColormap(['c','r'])
If marker or markersize is not None, useful kwargs include:
marker
markersize
color
See documentation for plot() for details.
Useful values for marker include:
's' square (default)
'o' circle
'.' point
',' pixel
- stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
- STEM(x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
A stem plot plots vertical lines (using linefmt) at each x location
from the baseline to y, and places a marker there using markerfmt. A
horizontal line at 0 is is plotted using basefmt
Return value is (markerline, stemlines, baseline) .
See
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html
for details and examples/stem_plot.py for a demo.
- step(self, x, y, *args, **kwargs)
- step(x, y, *args, **kwargs)
x and y must be 1-D sequences, and it is assumed, but not checked,
that x is uniformly increasing.
Make a step plot. The args and keyword args to step are the same
as the args to plot. See help plot for more info.
Additional keyword args for step:
* where: can be 'pre', 'post' or 'mid'; if 'pre', the
interval from x[i] to x[i+1] has level y[i];
if 'post', that interval has level y[i+1];
and if 'mid', the jumps in y occur half-way
between the x-values. Default is 'pre'.
- text(self, x, y, s, fontdict=None, withdash=False, **kwargs)
- TEXT(x, y, s, fontdict=None, **kwargs)
Add text in string s to axis at location x,y (data coords)
fontdict is a dictionary to override the default text properties.
If fontdict is None, the defaults are determined by your rc
parameters.
withdash=True will create a TextWithDash instance instead
of a Text instance.
Individual keyword arguments can be used to override any given
parameter
text(x, y, s, fontsize=12)
The default transform specifies that text is in data coords,
alternatively, you can specify text in axis coords (0,0 lower left and
1,1 upper right). The example below places text in the center of the
axes
text(0.5, 0.5,'matplotlib',
horizontalalignment='center',
verticalalignment='center',
transform = ax.transAxes,
)
You can put a rectangular box around the text instance (eg to
set a background color) by using the keyword bbox. bbox is a
dictionary of patches.Rectangle properties (see help
for Rectangle for a list of these). For example
text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
Valid 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: an agg.path_storage instance
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
- ticklabel_format(self, **kwargs)
- Convenience method for manipulating the ScalarFormatter
used by default for linear axes.
kwargs:
style = 'sci' (or 'scientific') or 'plain';
plain turns off scientific notation
axis = 'x', 'y', or 'both'
Only the major ticks are affected.
If the method is called when the ScalarFormatter is not
the one being used, an AttributeError will be raised with
no additional error message.
Additional capabilities and/or friendlier error checking may be added.
- twinx(self)
- ax = twinx()
create a twin of Axes for generating a plot with a sharex
x-axis but independent y axis. The y-axis of self will have
ticks on left and the returned axes will have ticks on the
right
- twiny(self)
- ax = twiny()
create a twin of Axes for generating a plot with a shared
y-axis but independent x axis. The x-axis of self will have
ticks on bottom and the returned axes will have ticks on the
top
- update_datalim(self, xys)
- Update the data lim bbox with seq of xy tups or equiv. 2-D array
- update_datalim_numerix(self, x, y)
- Update the data lim bbox with seq of xy tups
- vlines(self, x, ymin, ymax, colors='k', linestyle='solid', label='', **kwargs)
- VLINES(x, ymin, ymax, color='k')
Plot vertical lines at each x from ymin to ymax. ymin or ymax can be
scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the heights of the lines are
determined by ymin and ymax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the collections.LineCollection that was added
kwargs are collections.LineCollection properties:
alpha: float or sequence of floats
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
figure: a matplotlib.figure.Figure instance
label: any string
linestyle: ['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
segments: unknown
transform: a matplotlib.transform transformation instance
verts: unknown
visible: [True | False]
zorder: any number
- xaxis_date(self, tz=None)
- Sets up x-axis ticks and labels that treat the x data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- xaxis_inverted(self)
- Returns True if the x-axis is inverted.
- xcorr(self, x, y, normed=False, detrend=<function detrend_none at 0x868817c>, usevlines=False, maxlags=None, **kwargs)
- XCORR(x, y, normed=False, detrend=mlab.detrend_none, usevlines=False, **kwargs):
Plot the cross correlation between x and y. If normed=True,
normalize the data but the cross correlation at 0-th lag. x
and y are detrended by the detrend callable (default no
normalization. x and y must be equal length
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
- yaxis_date(self, tz=None)
- Sets up y-axis ticks and labels that treat the y data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- yaxis_inverted(self)
- Returns True if the y-axis is inverted.
Data and other attributes inherited from Axes:
- scaled = {0: 'linear', 1: 'log'}
Methods inherited from matplotlib.artist.Artist:
- add_callback(self, func)
- convert_xunits(self, x)
- for artists in an axes, if the xaxis as units support,
convert x using xaxis unit type
- convert_yunits(self, y)
- for artists in an axes, if the yaxis as units support,
convert y using yaxis unit type
- get_alpha(self)
- Return the alpha value used for blending - not supported on all
backends
- get_animated(self)
- return the artist's animated state
- get_axes(self)
- return the axes instance the artist resides in, or None
- get_clip_box(self)
- Return artist clipbox
- get_clip_on(self)
- Return whether artist uses clipping
- get_clip_path(self)
- Return artist clip path
- get_contains(self)
- return the _contains test used by the artist, or None for default.
- get_figure(self)
- return the figure instance
- get_label(self)
- get_picker(self)
- return the Pickeration instance used by this artist
- get_transform(self)
- return the Transformation instance used by this artist
- get_visible(self)
- return the artist's visiblity
- get_zorder(self)
- have_units(self)
- return True if units are set on the x or y axes
- hitlist(self, event)
- List the children of the artist which contain the mouse event
- is_figure_set(self)
- is_transform_set(self)
- Artist has transform explicity let
- pchanged(self)
- fire event when property changed
- pickable(self)
- return True if self is pickable
- remove(self)
- Remove the artist from the figure if possible. The effect will not
be visible until the figure is redrawn, e.g., with ax.draw_idle().
Call ax.relim() to update the axes limits if desired.
Note: relim() will not see collections even if the collection
was added to axes with autolim=True.
Note: there is no support for removing the artist's legend entry.
- remove_callback(self, oid)
- set(self, **kwargs)
- A tkstyle set command, pass kwargs to set properties
- set_alpha(self, alpha)
- Set the alpha value used for blending - not supported on
all backends
ACCEPTS: float
- set_animated(self, b)
- set the artist's animation state
ACCEPTS: [True | False]
- set_axes(self, axes)
- set the axes instance the artist resides in, if any
ACCEPTS: an axes instance
- set_clip_box(self, clipbox)
- Set the artist's clip Bbox
ACCEPTS: a matplotlib.transform.Bbox instance
- set_clip_on(self, b)
- Set whether artist uses clipping
ACCEPTS: [True | False]
- set_clip_path(self, path)
- Set the artist's clip path
ACCEPTS: an agg.path_storage instance
- set_contains(self, picker)
- Replace the contains test used by this artist. The new picker should
be a callable function which determines whether the artist is hit by the
mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit=True and props
is a dictionary of properties you want returned with the contains test.
- set_label(self, s)
- Set the line label to s for auto legend
ACCEPTS: any string
- set_lod(self, on)
- Set Level of Detail on or off. If on, the artists may examine
things like the pixel width of the axes and draw a subset of
their contents accordingly
ACCEPTS: [True | False]
- set_picker(self, picker)
- set the epsilon for picking used by this artist
picker can be one of the following:
None - picking is disabled for this artist (default)
boolean - if True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist
float - if picker is a number it is interpreted as an
epsilon tolerance in points and the the artist will fire
off an event if it's data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, eg the indices of the data within
epsilon of the pick event
function - if picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event.
hit, props = picker(artist, mouseevent)
to determine the hit test. if the mouse event is over the
artist, return hit=True and props is a dictionary of
properties you want added to the PickEvent attributes
ACCEPTS: [None|float|boolean|callable]
- set_transform(self, t)
- set the Transformation instance used by this artist
ACCEPTS: a matplotlib.transform transformation instance
- set_visible(self, b)
- set the artist's visiblity
ACCEPTS: [True | False]
- set_zorder(self, level)
- Set the zorder for the artist
ACCEPTS: any number
- update(self, props)
- update_from(self, other)
- copy properties from other to self
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
- zorder = 0
|
class Subplot(SubplotBase, Axes) |
|
subplot class for Cartesian Axes
This is not normally instantiated by the user; instead,
use the Figure.add_subplot method. |
|
- Method resolution order:
- Subplot
- SubplotBase
- Axes
- matplotlib.artist.Artist
Methods defined here:
- __init__(self, fig, *args, **kwargs)
- See SubplotBase and Axes base class documentation for args and kwargs
- __str__(self)
Methods inherited from SubplotBase:
- change_geometry(self, numrows, numcols, num)
- change subplot geometry, eg from 1,1,1 to 2,2,3
- get_geometry(self)
- get the subplot geometry, eg 2,2,3
- is_first_col(self)
- is_first_row(self)
- is_last_col(self)
- is_last_row(self)
- label_outer(self)
- set the visible property on ticklabels so xticklabels are
visible only if the subplot is in the last row and yticklabels
are visible only if the subplot is in the first column
- update_params(self)
- update the subplot position from fig.subplotpars
Methods inherited from Axes:
- acorr(self, x, **kwargs)
- 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=False)
- 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)
- 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
- 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.
'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: an agg.path_storage instance
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, data_ratio=None)
- Use self._aspect and self._adjustable to modify the
axes box or the view limits.
The data_ratio kwarg is set to 1 for polar axes. It is
used only when _adjustable is 'box'.
- 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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
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'
- 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 0x868817c>, window=<function window_hanning at 0x868802c>, 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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 0x868817c>, window=<function window_hanning at 0x868802c>, 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*npy.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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- disconnect(self, cid)
- disconnect from the Axes event.
- 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)
- errorbar(self, x, y, yerr=None, xerr=None, fmt='-', ecolor=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, 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.
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.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:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
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_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_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 axes rectangle left, bottom, width, height
- get_renderer_cache(self)
- 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_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_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)
- return the xaxis scale string: log or linear
- 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_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_ylim(self)
- Get the y axis range [ymin, ymax]
- 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)
- return the yaxis scale string: log or linear
- 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- has_data(self)
- Return true if any artists have been added to axes.
This should not be used to determine whether the dataLim
need to be updated, and may not actually be useful for
anything.
- hist(self, x, bins=10, normed=0, bottom=None, align='edge', orientation='vertical', width=None, log=False, **kwargs)
- HIST(x, bins=10, normed=0, bottom=None,
align='edge', orientation='vertical', width=None,
log=False, **kwargs)
Compute the histogram of x. bins is either an integer number of
bins or a sequence giving the bins. x are the data to be binned.
The return values is (n, bins, patches)
If normed is true, the first element of the return tuple will
be the counts normalized to form a probability density, ie,
n/(len(x)*dbin). In a probability density, the integral of
the histogram should be one (we assume equally spaced bins);
you can verify that with
# trapezoidal integration of the probability density function
pdf, bins, patches = ax.hist(...)
print npy.trapz(pdf, bins)
align = 'edge' | 'center'. Interprets bins either as edge
or center values
orientation = 'horizontal' | 'vertical'. If horizontal, barh
will be used and the "bottom" kwarg will be the left edges.
width: the width of the bars. If None, automatically compute
the width.
log: if True, the histogram axis will be set to a log scale
kwargs are used to update the properties of the
hist Rectangles:
alpha: float
animated: [True | False]
antialiased or aa: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
edgecolor or ec: any matplotlib color
facecolor or fc: any matplotlib color
figure: a matplotlib.figure.Figure instance
fill: [True | False]
hatch: unknown
label: any string
linewidth or lw: float
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- hlines(self, y, xmin, xmax, colors='k', linestyle='solid', label='', **kwargs)
- HLINES(y, xmin, xmax, colors='k', linestyle='solid', **kwargs)
plot horizontal lines at each y from xmin to xmax. xmin or xmax can
be scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the widths of the lines are
determined by xmin and xmax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the LineCollection that was added
- hold(self, b=None)
- HOLD(b=None)
Set the hold state. If hold is None (default), toggle the
hold state. Else set the hold state to boolean value b.
Eg
hold() # toggle hold
hold(True) # hold is on
hold(False) # hold is off
When hold is True, subsequent plot commands will be added to
the current axes. When hold is False, the current axes and
figure will be cleared on the next plot command
- imshow(self, X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=1.0, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, **kwargs)
- IMSHOW(X, cmap=None, norm=None, aspect=None, interpolation=None,
alpha=1.0, vmin=None, vmax=None, origin=None, extent=None)
IMSHOW(X) - plot image X to current axes, resampling to scale to axes
size (X may be numpy array or PIL image)
IMSHOW(X, **kwargs) - Use keyword args to control image scaling,
colormapping etc. See below for details
Display the image in X to current axes. X may be a float array, a
uint8 array or a PIL image. If X is an array, X can have the following
shapes:
MxN : luminance (grayscale, float array only)
MxNx3 : RGB (float or uint8 array)
MxNx4 : RGBA (float or uint8 array)
The value for each component of MxNx3 and MxNx4 float arrays should be
in the range 0.0 to 1.0; MxN float arrays may be normalised.
A image.AxesImage instance is returned
The following kwargs are allowed:
* cmap is a cm colormap instance, eg cm.jet. If None, default to rc
image.cmap value (Ignored when X has RGB(A) information)
* aspect is one of: auto, equal, or a number. If None, default to rc
image.aspect value
* interpolation is one of:
'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
'hanning', 'hamming', 'hermite', 'kaiser', 'quadric',
'catrom', 'gaussian', 'bessel', 'mitchell', 'sinc',
'lanczos', 'blackman'
if interpolation is None, default to rc
image.interpolation. See also th the filternorm and
filterrad parameters
* norm is a mcolors.Normalize instance; default is
normalization(). This scales luminance -> 0-1 (only used for an
MxN float array).
* vmin and vmax are used to scale a luminance image to 0-1. If
either is None, the min and max of the luminance values will be
used. Note if you pass a norm instance, the settings for vmin and
vmax will be ignored.
* alpha = 1.0 : the alpha blending value
* origin is 'upper' or 'lower', to place the [0,0]
index of the array in the upper left or lower left corner of
the axes. If None, default to rc image.origin
* extent is (left, right, bottom, top) data values of the
axes. The default assigns zero-based row, column indices
to the x, y centers of the pixels.
* shape is for raw buffer images
* filternorm is a parameter for the antigrain image resize
filter. From the antigrain documentation, if normalize=1,
the filter normalizes integer values and corrects the
rounding errors. It doesn't do anything with the source
floating point values, it corrects only integers according
to the rule of 1.0 which means that any sum of pixel
weights must be equal to 1.0. So, the filter function
must produce a graph of the proper shape.
* filterrad: the filter radius for filters that have a radius
parameter, ie when interpolation is one of: 'sinc',
'lanczos' or 'blackman'
Additional kwargs are martist properties
- in_axes(self, xwin, ywin)
- return True is the point xwin, ywin (display coords) are in the Axes
- invert_xaxis(self)
- Invert the x-axis.
- invert_yaxis(self)
- Invert the y-axis.
- ishold(self)
- return the HOLD status of the axes
- legend(self, *args, **kwargs)
- LEGEND(*args, **kwargs)
Place a legend on the current axes at location loc. Labels are a
sequence of strings and loc can be a string or an integer specifying
the legend location
USAGE:
Make a legend with existing lines
>>> legend()
legend by itself will try and build a legend using the label
property of the lines/patches/collections. You can set the label of
a line by doing plot(x, y, label='my data') or line.set_label('my
data'). If label is set to '_nolegend_', the item will not be shown
in legend.
# automatically generate the legend from labels
legend( ('label1', 'label2', 'label3') )
# Make a legend for a list of lines and labels
legend( (line1, line2, line3), ('label1', 'label2', 'label3') )
# Make a legend at a given location, using a location argument
# legend( LABELS, LOC ) or
# legend( LINES, LABELS, LOC )
legend( ('label1', 'label2', 'label3'), loc='upper left')
legend( (line1, line2, line3), ('label1', 'label2', 'label3'), loc=2)
The location codes are
'best' : 0,
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right' : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center' : 10,
If none of these are suitable, loc can be a 2-tuple giving x,y
in axes coords, ie,
loc = 0, 1 is left top
loc = 0.5, 0.5 is center, center
and so on. The following kwargs are supported:
isaxes=True # whether this is an axes legend
numpoints = 4 # the number of points in the legend line
prop = FontProperties(size='smaller') # the font property
pad = 0.2 # the fractional whitespace inside the legend border
markerscale = 0.6 # the relative size of legend markers vs. original
shadow # if True, draw a shadow behind legend
labelsep = 0.005 # the vertical space between the legend entries
handlelen = 0.05 # the length of the legend lines
handletextsep = 0.02 # the space between the legend line and legend text
axespad = 0.02 # the border between the axes and legend edge
- loglog(self, *args, **kwargs)
- LOGLOG(*args, **kwargs)
Make a loglog plot with log scaling on the a and y axis. The args
to semilog x are the same as the args to plot. See help plot for
more info.
Optional keyword args supported are any of the kwargs
supported by plot or set_xscale or set_yscale. Notable, for
log scaling:
* basex: base of the x logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
* basey: base of the y logarithm
* subsy: the location of the minor yticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- matshow(self, Z, **kwargs)
- Plot a matrix as an image.
The matrix will be shown the way it would be printed,
with the first row at the top. Row and column numbering
is zero-based.
Argument:
Z anything that can be interpreted as a 2-D array
kwargs: all are passed to imshow. matshow sets defaults
for extent, origin, interpolation, and aspect; use care
in overriding the extent and origin kwargs, because they
interact. (Also, if you want to change them, you probably
should be using imshow directly in your own version of
matshow.)
Returns: an image.AxesImage instance
- pcolor(self, *args, **kwargs)
- pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the array of color values
X and Y, if given, specify the (x,y) coordinates of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). Ideally the dimensions of X and Y
should be one greater than those of C; if the dimensions are the
same, then the last row and column of C will be ignored.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
If either or both of X and Y are 1-D arrays or column vectors,
they will be expanded as needed into the appropriate 2-D arrays,
making a rectangular grid.
X,Y and C may be masked arrays. If either C[i,j], or one
of the vertices surrounding C[i,j] (X or Y at [i,j],[i+1,j],
[i,j+1],[i=1,j+1]) is masked, nothing is plotted.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
edgecolors can also be None to specify the rcParams
default, or any mpl color or sequence of colors.
* alpha=1.0 : the alpha blending value
Return value is a mcoll.PatchCollection
object
Grid Orientation
The orientation follows the Matlab(TM) convention: an
array C with shape (nrows, ncolumns) is plotted with
the column number as X and the row number as Y, increasing
up; hence it is plotted the way the array would be printed,
except that the Y axis is reversed. That is, C is taken
as C(y,x).
Similarly for meshgrid:
x = npy.arange(5)
y = npy.arange(3)
X, Y = meshgrid(x,y)
is equivalent to
X = array([[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]])
Y = array([[0, 0, 0, 0, 0],
[1, 1, 1, 1, 1],
[2, 2, 2, 2, 2]])
so if you have
C = rand( len(x), len(y))
then you need
pcolor(X, Y, C.T)
or
pcolor(C.T)
Dimensions
Matlab pcolor always discards
the last row and column of C, but matplotlib displays
the last row and column if X and Y are not specified, or
if X and Y have one more row and column than C.
kwargs can be used to control the PolyCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pcolorfast(self, *args, **kwargs)
- Experimental; this is a version of pcolor that
does not draw lines, that provides the fastest
possible rendering with the Agg backend, and that
can handle any quadrilateral grid.
pcolor(*args, **kwargs): pseudocolor plot of a 2-D array
Function signatures
pcolor(C, **kwargs)
pcolor(xr, yr, C, **kwargs)
pcolor(x, y, C, **kwargs)
pcolor(X, Y, C, **kwargs)
C is the 2D array of color values corresponding to quadrilateral
cells. Let (nr, nc) be its shape. C may be a masked array.
pcolor(C, **kwargs) is equivalent to
pcolor([0,nc], [0,nr], C, **kwargs)
xr, yr specify the ranges of x and y corresponding to the rectangular
region bounding C. If xr = [x0, x1] and yr = [y0,y1] then
x goes from x0 to x1 as the second index of C goes from 0 to nc,
etc. (x0, y0) is the outermost corner of cell (0,0), and (x1, y1)
is the outermost corner of cell (nr-1, nc-1). All cells are
rectangles of the same size. This is the fastest version.
x, y are 1D arrays of length nc+1 and nr+1, respectively, giving
the x and y boundaries of the cells. Hence the cells are
rectangular but the grid may be nonuniform. The speed is
intermediate. (The grid is checked, and if found to be
uniform the fast version is used.)
X and Y are 2D arrays with shape (nr+1, nc+1) that specify
the (x,y) coordinates of the corners of the colored
quadrilaterals; the quadrilateral for C[i,j] has corners at
(X[i,j],Y[i,j]), (X[i,j+1],Y[i,j+1]), (X[i+1,j],Y[i+1,j]),
(X[i+1,j+1],Y[i+1,j+1]). The cells need not be rectangular.
This is the most general, but the slowest to render. It may
produce faster and more compact output using ps, pdf, and
svg backends, however.
Note that the the column index corresponds to the x-coordinate,
and the row index corresponds to y; for details, see
the "Grid Orientation" section below.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm
* norm = Normalize() : mcolors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. If you pass a norm
instance, vmin and vmax will be None
* alpha=1.0 : the alpha blending value
Return value is an image if a regular or rectangular grid
is specified, and a QuadMesh collection in the general
quadrilateral case.
- pcolormesh(self, *args, **kwargs)
- PCOLORMESH(*args, **kwargs)
Function signatures
PCOLORMESH(C) - make a pseudocolor plot of matrix C
PCOLORMESH(X, Y, C) - a pseudo color plot of C on the matrices X and Y
PCOLORMESH(C, **kwargs) - Use keyword args to control colormapping and
scaling; see below
C may be a masked array, but X and Y may not. Masked array support
is implemented via cmap and norm; in contrast, pcolor simply does
not draw quadrilaterals with masked colors or vertices.
Optional keyword args are shown with their defaults below (you must
use kwargs for these):
* cmap = cm.jet : a cm Colormap instance from cm.
* norm = Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1. Instantiate it
with clip=False if C is a masked array.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used.
* shading = 'flat' : or 'faceted'. If 'faceted', a black grid is
drawn around each rectangle; if 'flat', edges are not drawn.
Default is 'flat', contrary to Matlab(TM).
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors='k'
More flexible specification of edgecolors, as in pcolor,
is not presently supported.
* alpha=1.0 : the alpha blending value
Return value is a collections.PatchCollection
object
See pcolor for an explantion of the grid orientation and the
expansion of 1-D X and/or Y to 2-D arrays.
kwargs can be used to control the collections.QuadMesh polygon
collection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- pick(self, *args)
- pick(mouseevent)
each child artist will fire a pick event if mouseevent is over
the artist and the artist has picker set
- pie(self, x, explode=None, labels=None, colors=None, autopct=None, pctdistance=0.59999999999999998, shadow=False, labeldistance=1.1000000000000001)
- PIE(x, explode=None, labels=None,
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
autopct=None, pctdistance=0.6, labeldistance=1.1, shadow=False)
Make a pie chart of array x. The fractional area of each wedge is
given by x/sum(x). If sum(x)<=1, then the values of x give the
fractional area directly and the array will not be normalized.
- explode, if not None, is a len(x) array which specifies the
fraction of the radius to offset that wedge.
- colors is a sequence of matplotlib color args that the pie chart
will cycle.
- labels, if not None, is a len(x) list of labels.
- autopct, if not None, is a string or function used to label the
wedges with their numeric value. The label will be placed inside
the wedge. If it is a format string, the label will be fmt%pct.
If it is a function, it will be called
- pctdistance is the ratio between the center of each pie slice
and the start of the text generated by autopct. Ignored if autopct
is None; default is 0.6.
- labeldistance is the radial distance at which the pie labels are drawn
- shadow, if True, will draw a shadow beneath the pie.
The pie chart will probably look best if the figure and axes are
square. Eg,
figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])
Return value:
If autopct is None, return a list of (patches, texts), where patches
is a sequence of mpatches.Wedge instances and texts is a
list of the label Text instnaces
If autopct is not None, return (patches, texts, autotexts), where
patches and texts are as above, and autotexts is a list of text
instances for the numeric labels
- plot(self, *args, **kwargs)
- PLOT(*args, **kwargs)
Plot lines and/or markers to the Axes. *args is a variable length
argument, allowing for multiple x,y pairs with an optional format
string. For example, each of the following is legal
plot(x,y) # plot x and y using the default line style and color
plot(x,y, 'bo') # plot x and y using blue circle markers
plot(y) # plot y using x as index array 0..N-1
plot(y, 'r+') # ditto, but with red plusses
If x and/or y is 2-Dimensional, then the corresponding columns
will be plotted.
An arbitrary number of x, y, fmt groups can be specified, as in
a.plot(x1, y1, 'g^', x2, y2, 'g-')
Return value is a list of lines that were added.
The following line styles are supported:
- : solid line
-- : dashed line
-. : dash-dot line
: : dotted line
. : points
, : pixels
o : circle symbols
^ : triangle up symbols
v : triangle down symbols
< : triangle left symbols
> : triangle right symbols
s : square symbols
+ : plus symbols
x : cross symbols
D : diamond symbols
d : thin diamond symbols
1 : tripod down symbols
2 : tripod up symbols
3 : tripod left symbols
4 : tripod right symbols
h : hexagon symbols
H : rotated hexagon symbols
p : pentagon symbols
| : vertical line symbols
_ : horizontal line symbols
steps : use gnuplot style 'steps' # kwarg only
The following color abbreviations are supported
b : blue
g : green
r : red
c : cyan
m : magenta
y : yellow
k : black
w : white
In addition, you can specify colors in many weird and
wonderful ways, including full names 'green', hex strings
'#008000', RGB or RGBA tuples (0,1,0,1) or grayscale
intensities as a string '0.8'. Of these, the string
specifications can be used in place of a fmt group, but the
tuple forms can be used only as kwargs.
Line styles and colors are combined in a single format string, as in
'bo' for blue circles.
The **kwargs can be used to set line properties (any property that has
a set_* method). You can use this to set a line label (for auto
legends), linewidth, anitialising, marker face color, etc. Here is an
example:
plot([1,2,3], [1,2,3], 'go-', label='line 1', linewidth=2)
plot([1,2,3], [1,4,9], 'rs', label='line 2')
axis([0, 4, 0, 10])
legend()
If you make multiple lines with one plot command, the kwargs apply
to all those lines, eg
plot(x1, y1, x2, y2, antialised=False)
Neither line will be antialiased.
The 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
kwargs scalex and scaley, if defined, are passed on
to autoscale_view to determine whether the x and y axes are
autoscaled; default True. See Axes.autoscale_view for more
information
- plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
- PLOT_DATE(x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs)
Similar to the plot() command, except the x or y (or both) data
is considered to be dates, and the axis is labeled accordingly.
x or y (or both) can be a sequence of dates represented as
float days since 0001-01-01 UTC.
fmt is a plot format string.
tz is the time zone to use in labelling dates. Defaults to rc value.
If xdate is True, the x-axis will be labeled with dates.
If ydate is True, the y-axis will be labeled with dates.
Note if you are using custom date tickers and formatters, it
may be necessary to set the formatters/locators after the call
to plot_date since plot_date will set the default tick locator
to ticker.AutoDateLocator (if the tick locator is not already set to
a ticker.DateLocator instance) and the default tick formatter to
AutoDateFormatter (if the tick formatter is not already set to
a DateFormatter instance).
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
See dates for helper functions date2num, num2date
and drange for help on creating the required floating point dates
- psd(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=0, **kwargs)
- PSD(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=0, **kwargs)
The power spectral density by Welches average periodogram method. The
vector x is divided into NFFT length segments. Each segment is
detrended by function detrend and windowed by function window.
noperlap gives the length of the overlap between segments. The
absolute(fft(segment))**2 of each segment are averaged to compute Pxx,
with a scaling to correct for power loss due to windowing. Fs is the
sampling frequency.
* NFFT is the length of the fft segment; must be a power of 2
* Fs is the sampling frequency.
* Fc is the center frequency of x (defaults to 0), which offsets
the yextents of the image to reflect the frequency range used
when a signal is acquired and then filtered and downsampled to
baseband.
* detrend - the function applied to each segment before fft-ing,
designed to remove the mean or linear trend. Unlike in matlab,
where the detrend parameter is a vector, in matplotlib is it a
function. The mlab module defines detrend_none, detrend_mean,
detrend_linear, but you can use a custom function as well.
* window - the function used to window the segments. window is a
function, unlike in matlab(TM) where it is a vector. mlab defines
window_none, window_hanning, but you can use a custom function
as well.
* noverlap gives the length of the overlap between segments.
Returns the tuple Pxx, freqs
For plotting, the power is plotted as 10*npy.log10(pxx) for decibels,
though pxx itself is returned
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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- quiver(self, *args, **kw)
- Plot a 2-D field of arrows.
Function signatures:
quiver(U, V, **kw)
quiver(U, V, C, **kw)
quiver(X, Y, U, V, **kw)
quiver(X, Y, U, V, C, **kw)
Arguments:
X, Y give the x and y coordinates of the arrow locations
(default is tail of arrow; see 'pivot' kwarg)
U, V give the x and y components of the arrow vectors
C is an optional array used to map colors to the arrows
All arguments may be 1-D or 2-D arrays or sequences.
If X and Y are absent, they will be generated as a uniform grid.
If U and V are 2-D arrays but X and Y are 1-D, and if
len(X) and len(Y) match the column and row dimensions
of U, then X and Y will be expanded with meshgrid.
U, V, C may be masked arrays, but masked X, Y are not
supported at present.
Keyword arguments (default given first):
* units = 'width' | 'height' | 'dots' | 'inches' | 'x' | 'y'
arrow units; the arrow dimensions *except for length*
are in multiples of this unit.
* scale = None | float
data units per arrow unit, e.g. m/s per plot width;
a smaller scale parameter makes the arrow longer.
If None, a simple autoscaling algorithm is used, based
on the average vector length and the number of vectors.
Arrow dimensions and scales can be in any of several units:
'width' or 'height': the width or height of the axes
'dots' or 'inches': pixels or inches, based on the figure dpi
'x' or 'y': X or Y data units
In all cases the arrow aspect ratio is 1, so that if U==V the angle
of the arrow on the plot is 45 degrees CCW from the X-axis.
The arrows scale differently depending on the units, however.
For 'x' or 'y', the arrows get larger as one zooms in; for other
units, the arrow size is independent of the zoom state. For
'width or 'height', the arrow size increases with the width and
height of the axes, respectively, when the the window is resized;
for 'dots' or 'inches', resizing does not change the arrows.
* width = ? shaft width in arrow units; default depends on
choice of units, above, and number of vectors;
a typical starting value is about
0.005 times the width of the plot.
* headwidth = 3 head width as multiple of shaft width
* headlength = 5 head length as multiple of shaft width
* headaxislength = 4.5 head length at shaft intersection
* minshaft = 1 length below which arrow scales, in units
of head length. Do not set this to less
than 1, or small arrows will look terrible!
* minlength = 1 minimum length as a multiple of shaft width;
if an arrow length is less than this, plot a
dot (hexagon) of this diameter instead.
The defaults give a slightly swept-back arrow; to make the
head a triangle, make headaxislength the same as headlength.
To make the arrow more pointed, reduce headwidth or increase
headlength and headaxislength.
To make the head smaller relative to the shaft, scale down
all the head* parameters.
You will probably do best to leave minshaft alone.
* pivot = 'tail' | 'middle' | 'tip'
The part of the arrow that is at the grid point; the arrow
rotates about this point, hence the name 'pivot'.
* color = 'k' | any matplotlib color spec or sequence of color specs.
This is a synonym for the PolyCollection facecolor kwarg.
If C has been set, 'color' has no effect.
* All PolyCollection kwargs are valid, in the sense that they
will be passed on to the PolyCollection constructor.
In particular, one might want to use, for example:
linewidths = (1,), edgecolors = ('g',)
to make the arrows have green outlines of unit width.
- quiverkey(self, *args, **kw)
- Add a key to a quiver plot.
Function signature:
quiverkey(Q, X, Y, U, label, **kw)
Arguments:
Q is the Quiver instance returned by a call to quiver.
X, Y give the location of the key; additional explanation follows.
U is the length of the key
label is a string with the length and units of the key
Keyword arguments (default given first):
* coordinates = 'axes' | 'figure' | 'data' | 'inches'
Coordinate system and units for X, Y: 'axes' and 'figure'
are normalized coordinate systems with 0,0 in the lower
left and 1,1 in the upper right; 'data' are the axes
data coordinates (used for the locations of the vectors
in the quiver plot itself); 'inches' is position in the
figure in inches, with 0,0 at the lower left corner.
* color overrides face and edge colors from Q.
* labelpos = 'N' | 'S' | 'E' | 'W'
Position the label above, below, to the right, to the left
of the arrow, respectively.
* labelsep = 0.1 inches distance between the arrow and the label
* labelcolor (defaults to default Text color)
* fontproperties is a dictionary with keyword arguments accepted
by the FontProperties initializer: family, style, variant,
size, weight
Any additional keyword arguments are used to override vector
properties taken from Q.
The positioning of the key depends on X, Y, coordinates, and
labelpos. If labelpos is 'N' or 'S', X,Y give the position
of the middle of the key arrow. If labelpos is 'E', X,Y
positions the head, and if labelpos is 'W', X,Y positions the
tail; in either of these two cases, X,Y is somewhere in the middle
of the arrow+label key object.
- redraw_in_frame(self)
- 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)
- relim(self)
- recompute the datalimits based on current artists
- scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, faceted=True, verts=None, **kwargs)
- SCATTER(x, y, s=20, c='b', marker='o', cmap=None, norm=None,
vmin=None, vmax=None, alpha=1.0, linewidths=None,
faceted=True, **kwargs)
Supported function signatures:
SCATTER(x, y, **kwargs)
SCATTER(x, y, s, **kwargs)
SCATTER(x, y, s, c, **kwargs)
Make a scatter plot of x versus y, where x, y are 1-D sequences
of the same length, N.
Arguments s and c can also be given as kwargs; this is encouraged
for readability.
s is a size in points^2. It is a scalar
or an array of the same length as x and y.
c is a color and can be a single color format string,
or a sequence of color specifications of length N,
or a sequence of N numbers to be mapped to colors
using the cmap and norm specified via kwargs (see below).
Note that c should not be a single numeric RGB or RGBA
sequence because that is indistinguishable from an array
of values to be colormapped. c can be a 2-D array in which
the rows are RGB or RGBA, however.
The marker can be one of
's' : square
'o' : circle
'^' : triangle up
'>' : triangle right
'v' : triangle down
'<' : triangle left
'd' : diamond
'p' : pentagram
'h' : hexagon
'8' : octagon
If marker is None and verts is not None, verts is a sequence
of (x,y) vertices for a custom scatter symbol.
s is a size argument in points squared.
Any or all of x, y, s, and c may be masked arrays, in which
case all masks will be combined and only unmasked points
will be plotted.
Other keyword args; the color mapping and normalization arguments will
be used only if c is an array of floats
* cmap = cm.jet : a colors.Colormap instance from cm.
defaults to rc image.cmap
* norm = colors.Normalize() : colors.Normalize instance
is used to scale luminance data to 0,1.
* vmin=None and vmax=None : vmin and vmax are used in conjunction
with norm to normalize luminance data. If either are None, the
min and max of the color array C is used. Note if you pass a norm
instance, your settings for vmin and vmax will be ignored
* alpha =1.0 : the alpha value for the patches
* linewidths, if None, defaults to (lines.linewidth,). Note
that this is a tuple, and if you set the linewidths
argument you must set it as a sequence of floats, as
required by RegularPolyCollection -- see
collections.RegularPolyCollection for details
* faceted: if True, will use the default edgecolor for the
markers. If False, will set the edgecolors to be the same
as the facecolors.
This kwarg is deprecated;
please use the edgecolors kwarg instead:
shading='flat' --> edgecolors='None'
shading='faceted --> edgecolors=None
edgecolors also can be any mpl color or sequence of colors.
Optional kwargs control the PatchCollection properties:
alpha: float
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
edgecolor: matplotlib color arg or sequence of rgba tuples
edgecolors: unknown
facecolor: matplotlib color arg or sequence of rgba tuples
facecolors: unknown
figure: a matplotlib.figure.Figure instance
label: any string
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]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
A Collection instance is returned
- semilogx(self, *args, **kwargs)
- SEMILOGX(*args, **kwargs)
Make a semilog plot with log scaling on the x axis. The args to
semilog x are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_xscale. Notable, for log scaling:
* basex: base of the logarithm
* subsx: the location of the minor ticks; None defaults to
autosubs, which depend on the number of decades in the
plot; see set_xscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- semilogy(self, *args, **kwargs)
- SEMILOGY(*args, **kwargs):
Make a semilog plot with log scaling on the y axis. The args to
semilogy are the same as the args to plot. See help plot for more
info.
Optional keyword args supported are any of the kwargs supported by
plot or set_yscale. Notable, for log scaling:
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot; see set_yscale for details
The remaining 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: an agg.path_storage instance
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: (npy.array xdata, npy.array ydata)
figure: a matplotlib.figure.Figure instance
label: any string
linestyle or ls: [ '-' | '--' | '-.' | ':' | 'steps' | '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.transform transformation instance
visible: [True | False]
xdata: npy.array
ydata: npy.array
zorder: any number
- set_adjustable(self, adjustable)
- ACCEPTS: ['box' | 'datalim']
- set_anchor(self, anchor)
- ACCEPTS: ['C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W']
- set_aspect(self, aspect, adjustable=None, anchor=None)
- aspect:
'auto' - automatic; fill position rectangle with data
'normal' - same as 'auto'; deprecated
'equal' - same scaling from data to plot units for x and y
num - a circle will be stretched such that the height
is num times the width. aspect=1 is the same as
aspect='equal'.
adjustable:
'box' - change physical size of axes
'datalim' - change xlim or ylim
anchor:
'C' - centered
'SW' - lower left corner
'S' - middle of bottom edge
'SE' - lower right corner
etc.
ACCEPTS: ['auto' | 'equal' | aspect_ratio]
- set_autoscale_on(self, b)
- Set whether autoscaling is applied on plot commands
ACCEPTS: True|False
- set_axis_bgcolor(self, color)
- set the axes background color
ACCEPTS: any matplotlib color - see help(colors)
- set_axis_off(self)
- turn off the axis
ACCEPTS: void
- set_axis_on(self)
- turn on the axis
ACCEPTS: void
- set_axisbelow(self, b)
- Set whether the axis ticks and gridlines are above or below most artists
ACCEPTS: True|False
- set_cursor_props(self, *args)
- Set the cursor property as
ax.set_cursor_props(linewidth, color) OR
ax.set_cursor_props((linewidth, color))
ACCEPTS: a (float, color) tuple
- set_figure(self, fig)
- Set the Axes figure
ACCEPTS: a Figure instance
- set_frame_on(self, b)
- Set whether the axes rectangle patch is drawn
ACCEPTS: True|False
- set_navigate(self, b)
- Set whether the axes responds to navigation toolbar commands
ACCEPTS: True|False
- set_navigate_mode(self, b)
- Set the navigation toolbar button status;
this is not a user-API function.
- set_position(self, pos, which='both')
- Set the axes position with pos = [left, bottom, width, height]
in relative 0,1 coords
There are two position variables: one which is ultimately
used, but which may be modified by apply_aspect, and a second
which is the starting point for apply_aspect.
which = 'active' to change the first;
'original' to change the second;
'both' to change both
ACCEPTS: len(4) sequence of floats
- set_title(self, label, fontdict=None, **kwargs)
- SET_TITLE(label, fontdict=None, **kwargs):
Set the title for the axes. See the text docstring for information
of how override and the optional args work
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: an agg.path_storage instance
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
ACCEPTS: str
- set_xbound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the x-axis.
This method will honor axes inversion regardless of parameter order.
- set_xlabel(self, xlabel, fontdict=None, **kwargs)
- SET_XLABEL(xlabel, fontdict=None, **kwargs)
Set the label for the xaxis. See the text docstring for information
of how override and the optional args work.
Valid 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: an agg.path_storage instance
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
ACCEPTS: str
- set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs)
- set_xlim(self, *args, **kwargs):
Set the limits for the xaxis; v = [xmin, xmax]
set_xlim((valmin, valmax))
set_xlim(valmin, valmax)
set_xlim(xmin=1) # xmax unchanged
set_xlim(xmax=1) # xmin unchanged
Valid kwargs:
xmin : the min of the xlim
xmax : the max of the xlim
emit : notify observers of lim change
Returns the current xlimits as a length 2 tuple
ACCEPTS: len(2) sequence of floats
- set_xscale(self, value, basex=10, subsx=None)
- SET_XSCALE(value, basex=10, subsx=None)
Set the xscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basex: base of the logarithm
* subsx: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsx=(1,2,5) will
put minor ticks on 1,2,5,11,12,15,21, ....To turn off
minor ticking, set subsx=[]
ACCEPTS: ['log' | 'linear' ]
- set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_xticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the xtick labels with list of strings labels Return a list of axis
text instances.
kwargs set the Text properties. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_xticks(self, ticks, minor=False)
- Set the x ticks with list of ticks
ACCEPTS: sequence of floats
- set_ybound(self, lower=None, upper=None)
- Set the lower and upper numerical bounds of the y-axis.
This method will honor axes inversion regardless of parameter order.
- set_ylabel(self, ylabel, fontdict=None, **kwargs)
- SET_YLABEL(ylabel, fontdict=None, **kwargs)
Set the label for the yaxis
See the text doctstring for information of how override and
the optional args work
Valid 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: an agg.path_storage instance
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
ACCEPTS: str
- set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs)
- set_ylim(self, *args, **kwargs):
Set the limits for the yaxis; v = [ymin, ymax]
set_ylim((valmin, valmax))
set_ylim(valmin, valmax)
set_ylim(ymin=1) # ymax unchanged
set_ylim(ymax=1) # ymin unchanged
Valid kwargs:
ymin : the min of the ylim
ymax : the max of the ylim
emit : notify observers of lim change
Returns the current ylimits as a length 2 tuple
ACCEPTS: len(2) sequence of floats
- set_yscale(self, value, basey=10, subsy=None)
- SET_YSCALE(value, basey=10, subsy=None)
Set the yscaling: 'log' or 'linear'
If value is 'log', the additional kwargs have the following meaning
* basey: base of the logarithm
* subsy: a sequence of the location of the minor ticks;
None defaults to autosubs, which depend on the number of
decades in the plot. Eg for base 10, subsy=(1,2,5) will
put minor ticks on 1,2,5,11,12,15, 21, ....To turn off
minor ticking, set subsy=[]
ACCEPTS: ['log' | 'linear']
- set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs)
- set_yticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the ytick labels with list of strings labels. Return a list of
Text instances.
kwargs set Text properties for the labels. Valid properties are
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: an agg.path_storage instance
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
ACCEPTS: sequence of strings
- set_yticks(self, ticks, minor=False)
- Set the y ticks with list of ticks
ACCEPTS: sequence of floats
- sharex_foreign(self, axforeign)
- You can share your x-axis view limits with another Axes in the
same Figure by using the sharex and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the xaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- sharey_foreign(self, axforeign)
- You can share your y-axis view limits with another Axes in the
same Figure by using the sharey and sharey property of the
Axes. But this doesn't work for Axes in a different figure.
This function sets of the callbacks so that when the yaxis of
this Axes or the Axes in a foreign figure are changed, both
will be synchronized.
The connection ids for the self.callbacks and
axforeign.callbacks cbook.CallbackRegistry instances are
returned in case you want to disconnect the coupling
- specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=<function detrend_none at 0x868817c>, window=<function window_hanning at 0x868802c>, noverlap=128, cmap=None, xextent=None)
- SPECGRAM(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window = mlab.window_hanning, noverlap=128,
cmap=None, xextent=None)
Compute a spectrogram of data in x. Data are split into NFFT length
segements and the PSD of each section is computed. The windowing
function window is applied to each segment, and the amount of overlap
of each segment is specified with noverlap.
* cmap is a colormap; if None use default determined by rc
* xextent is the image extent in the xaxes xextent=xmin, xmax -
default 0, max(bins), 0, max(freqs) where bins is the return
value from mlab.specgram
* See help(psd) for information on the other keyword arguments.
Return value is (Pxx, freqs, bins, im), where
bins are the time points the spectrogram is calculated over
freqs is an array of frequencies
Pxx is a len(times) x len(freqs) array of power
im is a image.AxesImage.
Note: If x is real (i.e. non-complex) only the positive spectrum is
shown. If x is complex both positive and negative parts of the
spectrum are shown.
- spy(self, Z, precision=None, marker=None, markersize=None, aspect='equal', **kwargs)
- spy(Z) plots the sparsity pattern of the 2-D array Z
If precision is None, any non-zero value will be plotted;
else, values of absolute(Z)>precision will be plotted.
The array will be plotted as it would be printed, with
the first index (row) increasing down and the second
index (column) increasing to the right.
By default aspect is 'equal' so that each array element
occupies a square space; set the aspect kwarg to 'auto'
to allow the plot to fill the plot box, or to any scalar
number to specify the aspect ratio of an array element
directly.
Two plotting styles are available: image or marker. Both
are available for full arrays, but only the marker style
works for scipy.sparse.spmatrix instances.
If marker and markersize are None, an image will be
returned and any remaining kwargs are passed to imshow;
else, a Line2D object will be returned with the value
of marker determining the marker type, and any remaining
kwargs passed to the axes plot method.
If marker and markersize are None, useful kwargs include:
cmap
alpha
See documentation for imshow() for details.
For controlling colors, e.g. cyan background and red marks, use:
cmap = mcolors.ListedColormap(['c','r'])
If marker or markersize is not None, useful kwargs include:
marker
markersize
color
See documentation for plot() for details.
Useful values for marker include:
's' square (default)
'o' circle
'.' point
',' pixel
- stem(self, x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
- STEM(x, y, linefmt='b-', markerfmt='bo', basefmt='r-')
A stem plot plots vertical lines (using linefmt) at each x location
from the baseline to y, and places a marker there using markerfmt. A
horizontal line at 0 is is plotted using basefmt
Return value is (markerline, stemlines, baseline) .
See
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/stem.html
for details and examples/stem_plot.py for a demo.
- step(self, x, y, *args, **kwargs)
- step(x, y, *args, **kwargs)
x and y must be 1-D sequences, and it is assumed, but not checked,
that x is uniformly increasing.
Make a step plot. The args and keyword args to step are the same
as the args to plot. See help plot for more info.
Additional keyword args for step:
* where: can be 'pre', 'post' or 'mid'; if 'pre', the
interval from x[i] to x[i+1] has level y[i];
if 'post', that interval has level y[i+1];
and if 'mid', the jumps in y occur half-way
between the x-values. Default is 'pre'.
- table(self, **kwargs)
- TABLE(cellText=None, cellColours=None,
cellLoc='right', colWidths=None,
rowLabels=None, rowColours=None, rowLoc='left',
colLabels=None, colColours=None, colLoc='center',
loc='bottom', bbox=None):
Add a table to the current axes. Returns a table instance. For
finer grained control over tables, use the Table class and add it
to the axes with add_table.
Thanks to John Gill for providing the class and table.
kwargs control the Table properties:
alpha: float
animated: [True | False]
axes: an axes instance
clip_box: a matplotlib.transform.Bbox instance
clip_on: [True | False]
clip_path: an agg.path_storage instance
contains: unknown
figure: a matplotlib.figure.Figure instance
fontsize: a float in points
label: any string
lod: [True | False]
picker: [None|float|boolean|callable]
transform: a matplotlib.transform transformation instance
visible: [True | False]
zorder: any number
- text(self, x, y, s, fontdict=None, withdash=False, **kwargs)
- TEXT(x, y, s, fontdict=None, **kwargs)
Add text in string s to axis at location x,y (data coords)
fontdict is a dictionary to override the default text properties.
If fontdict is None, the defaults are determined by your rc
parameters.
withdash=True will create a TextWithDash instance instead
of a Text instance.
Individual keyword arguments can be used to override any given
parameter
text(x, y, s, fontsize=12)
The default transform specifies that text is in data coords,
alternatively, you can specify text in axis coords (0,0 lower left and
1,1 upper right). The example below places text in the center of the
axes
text(0.5, 0.5,'matplotlib',
horizontalalignment='center',
verticalalignment='center',
transform = ax.transAxes,
)
You can put a rectangular box around the text instance (eg to
set a background color) by using the keyword bbox. bbox is a
dictionary of patches.Rectangle properties (see help
for Rectangle for a list of these). For example
text(x, y, s, bbox=dict(facecolor='red', alpha=0.5))
Valid 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: an agg.path_storage instance
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
- ticklabel_format(self, **kwargs)
- Convenience method for manipulating the ScalarFormatter
used by default for linear axes.
kwargs:
style = 'sci' (or 'scientific') or 'plain';
plain turns off scientific notation
axis = 'x', 'y', or 'both'
Only the major ticks are affected.
If the method is called when the ScalarFormatter is not
the one being used, an AttributeError will be raised with
no additional error message.
Additional capabilities and/or friendlier error checking may be added.
- toggle_log_lineary(self)
- toggle between log and linear on the y axis
- twinx(self)
- ax = twinx()
create a twin of Axes for generating a plot with a sharex
x-axis but independent y axis. The y-axis of self will have
ticks on left and the returned axes will have ticks on the
right
- twiny(self)
- ax = twiny()
create a twin of Axes for generating a plot with a shared
y-axis but independent x axis. The x-axis of self will have
ticks on bottom and the returned axes will have ticks on the
top
- update_datalim(self, xys)
- Update the data lim bbox with seq of xy tups or equiv. 2-D array
- update_datalim_numerix(self, x, y)
- Update the data lim bbox with seq of xy tups
- vlines(self, x, ymin, ymax, colors='k', linestyle='solid', label='', **kwargs)
- VLINES(x, ymin, ymax, color='k')
Plot vertical lines at each x from ymin to ymax. ymin or ymax can be
scalars or len(x) numpy arrays. If they are scalars, then the
respective values are constant, else the heights of the lines are
determined by ymin and ymax
colors is a line collections color args, either a single color
or a len(x) list of colors
linestyle is one of solid|dashed|dashdot|dotted
Returns the collections.LineCollection that was added
kwargs are collections.LineCollection properties:
alpha: float or sequence of floats
animated: [True | False]
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: an agg.path_storage instance
cmap: a colormap
color: matplotlib color arg or sequence of rgba tuples
colorbar: unknown
contains: unknown
figure: a matplotlib.figure.Figure instance
label: any string
linestyle: ['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
segments: unknown
transform: a matplotlib.transform transformation instance
verts: unknown
visible: [True | False]
zorder: any number
- xaxis_date(self, tz=None)
- Sets up x-axis ticks and labels that treat the x data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- xaxis_inverted(self)
- Returns True if the x-axis is inverted.
- xcorr(self, x, y, normed=False, detrend=<function detrend_none at 0x868817c>, usevlines=False, maxlags=None, **kwargs)
- XCORR(x, y, normed=False, detrend=mlab.detrend_none, usevlines=False, **kwargs):
Plot the cross correlation between x and y. If normed=True,
normalize the data but the cross correlation at 0-th lag. x
and y are detrended by the detrend callable (default no
normalization. x and y must be equal length
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
- yaxis_date(self, tz=None)
- Sets up y-axis ticks and labels that treat the y data as dates.
tz is the time zone to use in labeling dates. Defaults to rc value.
- yaxis_inverted(self)
- Returns True if the y-axis is inverted.
Data and other attributes inherited from Axes:
- scaled = {0: 'linear', 1: 'log'}
Methods inherited from matplotlib.artist.Artist:
- add_callback(self, func)
- convert_xunits(self, x)
- for artists in an axes, if the xaxis as units support,
convert x using xaxis unit type
- convert_yunits(self, y)
- for artists in an axes, if the yaxis as units support,
convert y using yaxis unit type
- get_alpha(self)
- Return the alpha value used for blending - not supported on all
backends
- get_animated(self)
- return the artist's animated state
- get_axes(self)
- return the axes instance the artist resides in, or None
- get_clip_box(self)
- Return artist clipbox
- get_clip_on(self)
- Return whether artist uses clipping
- get_clip_path(self)
- Return artist clip path
- get_contains(self)
- return the _contains test used by the artist, or None for default.
- get_figure(self)
- return the figure instance
- get_label(self)
- get_picker(self)
- return the Pickeration instance used by this artist
- get_transform(self)
- return the Transformation instance used by this artist
- get_visible(self)
- return the artist's visiblity
- get_zorder(self)
- have_units(self)
- return True if units are set on the x or y axes
- hitlist(self, event)
- List the children of the artist which contain the mouse event
- is_figure_set(self)
- is_transform_set(self)
- Artist has transform explicity let
- pchanged(self)
- fire event when property changed
- pickable(self)
- return True if self is pickable
- remove(self)
- Remove the artist from the figure if possible. The effect will not
be visible until the figure is redrawn, e.g., with ax.draw_idle().
Call ax.relim() to update the axes limits if desired.
Note: relim() will not see collections even if the collection
was added to axes with autolim=True.
Note: there is no support for removing the artist's legend entry.
- remove_callback(self, oid)
- set(self, **kwargs)
- A tkstyle set command, pass kwargs to set properties
- set_alpha(self, alpha)
- Set the alpha value used for blending - not supported on
all backends
ACCEPTS: float
- set_animated(self, b)
- set the artist's animation state
ACCEPTS: [True | False]
- set_axes(self, axes)
- set the axes instance the artist resides in, if any
ACCEPTS: an axes instance
- set_clip_box(self, clipbox)
- Set the artist's clip Bbox
ACCEPTS: a matplotlib.transform.Bbox instance
- set_clip_on(self, b)
- Set whether artist uses clipping
ACCEPTS: [True | False]
- set_clip_path(self, path)
- Set the artist's clip path
ACCEPTS: an agg.path_storage instance
- set_contains(self, picker)
- Replace the contains test used by this artist. The new picker should
be a callable function which determines whether the artist is hit by the
mouse event:
hit, props = picker(artist, mouseevent)
If the mouse event is over the artist, return hit=True and props
is a dictionary of properties you want returned with the contains test.
- set_label(self, s)
- Set the line label to s for auto legend
ACCEPTS: any string
- set_lod(self, on)
- Set Level of Detail on or off. If on, the artists may examine
things like the pixel width of the axes and draw a subset of
their contents accordingly
ACCEPTS: [True | False]
- set_picker(self, picker)
- set the epsilon for picking used by this artist
picker can be one of the following:
None - picking is disabled for this artist (default)
boolean - if True then picking will be enabled and the
artist will fire a pick event if the mouse event is over
the artist
float - if picker is a number it is interpreted as an
epsilon tolerance in points and the the artist will fire
off an event if it's data is within epsilon of the mouse
event. For some artists like lines and patch collections,
the artist may provide additional data to the pick event
that is generated, eg the indices of the data within
epsilon of the pick event
function - if picker is callable, it is a user supplied
function which determines whether the artist is hit by the
mouse event.
hit, props = picker(artist, mouseevent)
to determine the hit test. if the mouse event is over the
artist, return hit=True and props is a dictionary of
properties you want added to the PickEvent attributes
ACCEPTS: [None|float|boolean|callable]
- set_transform(self, t)
- set the Transformation instance used by this artist
ACCEPTS: a matplotlib.transform transformation instance
- set_visible(self, b)
- set the artist's visiblity
ACCEPTS: [True | False]
- set_zorder(self, level)
- Set the zorder for the artist
ACCEPTS: any number
- update(self, props)
- update_from(self, other)
- copy properties from other to self
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
- zorder = 0
|
class SubplotBase |
|
Base class for subplots, which are Axes instances with additional
methods to facilitate generating and manipulating a set of Axes
within a figure. |
|
Methods defined here:
- __init__(self, fig, *args)
- fig is a figure instance
args is numRows, numCols, plotNum
where the array of subplots in the figure has dimensions
numRows, numCols, and where plotNum is the number of the
subplot being created. plotNum starts at 1 in the upper
right corner and increases to the right.
If numRows<=numCols<=plotNum<10, args can be the decimal
integer numRows*100 + numCols*10 + plotNum.
- change_geometry(self, numrows, numcols, num)
- change subplot geometry, eg from 1,1,1 to 2,2,3
- get_geometry(self)
- get the subplot geometry, eg 2,2,3
- is_first_col(self)
- is_first_row(self)
- is_last_col(self)
- is_last_row(self)
- label_outer(self)
- set the visible property on ticklabels so xticklabels are
visible only if the subplot is in the last row and yticklabels
are visible only if the subplot is in the first column
- update_params(self)
- update the subplot position from fig.subplotpars
| |