| |
- matplotlib.artist.Artist
-
- Axes
-
- Subplot
- Axis
-
- XAxis
- YAxis
- Legend
- Tick
-
- XTick
- YTick
- TickLocator
class Axes(matplotlib.artist.Artist) |
|
Emulate matlab's axes command, creating axes with
Axes(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 |
|
Methods defined here:
- __init__(self, fig, position, axisbg='w')
- add_line(self, line)
- Add a line to the list of plot lines
- add_patch(self, patch)
- Add a line to the list of plot lines
- bar(self, x, y, width=0.80000000000000004, color='b', yerr=None, xerr=None, capsize=3)
- Make a bar plot with rectangles at x, x+width, 0, y
x and y are Numeric arrays
Return value is a list of Rectangle patch instances
xerr and yerr, if not None, will be used to generate errorbars
on the bar chart
- clear(self)
- cohere(self, x, y, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0)
- 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 docs for psd and csd for information
about the function arguments NFFT, detrend, windowm noverlap, as
well as the methods used to compute Pxy, Pxx and Pyy.
Returns the tuple Cxy, freqs
Refs:
Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
- csd(self, x, y, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0)
- 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. noverlap gives the length of the
overlap between segments. 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. Fs is the sampling
frequency.
NFFT must be a power of 2
detrend and window are functions, unlike in matlab where they are
vectors. For detrending you can use detrend_none, detrend_mean,
detrend_linear or a custom function. For windowing, you can use
window_none, window_hanning, or a custom function
Returns the tuple Pxy, freqs. Pxy is the cross spectrum (complex
valued), and 10*log10(|Pxy|) is plotted
Refs:
Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
- errorbar(self, x, y, yerr=None, xerr=None, fmt='b-', capsize=3)
- 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
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
Return value is a length 2 tuple. The first element is a list of
y symbol lines. The second element is a list of error bar lines.
capsize is the size of the error bar caps in points
- get_axis_bgcolor(self)
- Return the axis background color
- get_child_artists(self)
- get_xaxis(self)
- Return the XAxis instance
- get_xlim(self)
- Get the x axis range [xmin, xmax]
- get_xticklabels(self)
- Get the xtick labels as a list of AxisText instances
- get_xticks(self)
- Return the x ticks as a list of locations
- get_yaxis(self)
- Return the YAxis instance
- get_ylim(self)
- Get the y axis range [ymin, ymax]
- get_yticklabels(self)
- Get the ytick labels as a list of AxisText instances
- get_yticks(self)
- Return the y ticks as a list of locations
- grid(self, b)
- Set the axes grids on or off; b is a boolean
- hist(self, x, bins=10, normed=0)
- 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.
if noplot is True, just compute the histogram and return the
number of observations and the bins as an (n, bins) tuple.
If noplot is False, compute the histogram and plot it, returning
n, bins, patches
If normed is true, the first element of the return tuple will be the
counts normalized to form a probability distribtion, ie,
n/(len(x)*dbin)
- hlines(self, y, xmin, xmax, fmt='k-')
- 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
Returns a list of line instances that were added
- in_axes(self, xwin, ywin)
- legend(self, *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( LABELS )
>>> legend( ('label1', 'label2', 'label3') )
Make a legend for Line2D instances lines1, line2, line3
legend( LINES, LABELS )
>>> legend( (line1, line2, line3), ('label1', 'label2', 'label3') )
Make a legend at LOC
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 LOC location codes are
The location codes are
'best' : 0, (currently not supported, defaults to upper right)
'upper right' : 1, (default)
'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,
Return value is a sequence of text, line instances that make
up the legend
- loglog(self, *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
- panx(self, numsteps)
- Pan the x axis numsteps (plus pan right, minus pan left)
- pany(self, numsteps)
- Pan the x axis numsteps (plus pan up, minus pan down)
- pcolor(self, *args, **kwargs)
- pcolor(C) - make a pseudocolor plot of matrix C
pcolor(X, Y, C) - a pseudo color plot of C on the matrices X and Y
Shading:
The optional keyword arg shading ('flat' or 'faceted') will
determine whether a black grid is drawn around each pcolor
square. Default 'faceteted'
e.g.,
pcolor(C, shading='flat')
pcolor(X, Y, C, shading='faceted')
returns a list of patch objects
- plot(self, *args)
- Emulate matlab's plot command. *args is a variable length
argument, allowing for multiple x,y pairs with an optional
format string. For example, all of the following are legal,
assuming a is the Axis instance:
a.plot(x,y) # plot Numeric arrays y vs x
a.plot(x,y, 'bo') # plot Numeric arrays y vs x with blue circles
a.plot(y) # plot y using x = arange(len(y))
a.plot(y, 'r+') # ditto with red plusses
An arbitrary number of x, y, fmt groups can be specified, as in
a.plot(x1, y1, 'g^', x2, y2, 'l-')
Returns a list of lines that were added
- psd(self, x, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0)
- 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 must be a power of 2
-- detrend and window are functions, unlike in matlab where they
are vectors. For detrending you can use detrend_none,
detrend_mean, detrend_linear or a custom function. For
windowing, you can use window_none, window_hanning, or a custom
function
-- if length x < NFFT, it will be zero padded to NFFT
Returns the tuple Pxx, freqs
For plotting, the power is plotted as 10*log10(pxx)) for decibels,
though pxx itself is returned
Refs:
Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
- resize(self)
- scatter(self, x, y, s=None, c='b')
- Make a scatter plot of x versus y. s is a size (in data
coords) and can be either a scalar or an array of the same
length as x or y. c is a color and can be a single color
format string or an length(x) array of intensities which will
be mapped by the colormap jet.
If size is None a default size will be used
- semilogx(self, *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
- semilogy(self, *args, **kwargs)
- Make a semilog plot with log scaling on the y axis. The args to
semilog x are the same as the args to plot. See help plot for
more info
- set_axis_bgcolor(self, color)
- set_axis_off(self)
- set_axis_on(self)
- set_title(self, label, fontdict=None, **kwargs)
- Set the title for the xaxis
See the text docstring for information of how override and the
optional args work
- set_xlabel(self, xlabel, fontdict=None, **kwargs)
- Set the label for the xaxis
See the text docstring for information of how override and the
optional args work
- set_xlim(self, v)
- Set the limits for the xaxis; v = [xmin, xmax]
- set_xscale(self, value)
- set_xticklabels(self, labels, fontdict=None, **kwargs)
- Set the xtick labels with list of strings labels
Return a list of axis text instances
- set_xticks(self, ticks)
- Set the x ticks with list of ticks
- set_ylabel(self, ylabel, fontdict=None, **kwargs)
- Set the label for the yaxis
Defaults override is
override = {
'fontsize' : 10,
'verticalalignment' : 'center',
'horizontalalignment' : 'right',
'rotation'='vertical' : }
See the text doctstring for information of how override and
the optional args work
- set_ylim(self, v)
- Set the limits for the xaxis; v = [ymin, ymax]
- set_yscale(self, value)
- set_yticklabels(self, labels, fontdict=None, **kwargs)
- Set the ytick labels with list of strings labels.
Return a list of AxisText instances
- set_yticks(self, ticks)
- Set the y ticks with list of ticks
- text(self, x, y, text, fontdict=None, **kwargs)
- Add text to axis at location x,y (data coords)
fontdict is a dictionary to override the default text properties.
If fontdict is None, the default is
If len(args) the override dictionary will be:
'fontsize' : 10,
'verticalalignment' : 'bottom',
'horizontalalignment' : 'left'
**kwargs can in turn be used to override the override, as in
a.text(x,y,label, fontsize=12)
will have verticalalignment=bottom and
horizontalalignment=left but will have a fontsize of 12
The AxisText defaults are
'color' : 'k',
'fontname' : 'Sans',
'fontsize' : 10,
'fontweight' : 'bold',
'fontangle' : 'normal',
'horizontalalignment' : 'left'
'rotation' : 'horizontal',
'verticalalignment' : 'bottom',
'transx' : self.xaxis.transData,
'transy' : self.yaxis.transData,
transx and transy specify 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
ax = subplot(111)
text(0.5, 0.5,'matplotlib',
horizontalalignment='center',
verticalalignment='center',
transx = ax.xaxis.transAxis,
transy = ax.yaxis.transAxis,
)
- update_viewlim(self)
- Update the view limits with all the data in self
- vlines(self, 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
Returns a list of lines that were added
- zoomx(self, numsteps)
- Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)
- zoomy(self, numsteps)
- Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class Axis(matplotlib.artist.Artist) |
| |
Methods defined here:
- __init__(self, axes)
- Init the axis with the parent Axes instance
- autoscale_view(self)
- Try to choose the view limits intelligently
- build_artists(self)
- Call only after xaxis and yaxis have been initialized in axes
since the trasnforms require both
- format_tickval(self, x)
- Format the number x as a string
- get_child_artists(self)
- Return a list of all Artist instances contained by Axis
- get_cm_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val cm to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_gridlines()
- Return a list of Line2D for grid lines
- get_inches_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val inches to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_label(self)
- Return the axis label as an AxisText instance
- get_mm_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val mm to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_numticks(self)
- get_pts_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val points to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_ticklabels(self)
- Return a list of AxisText instances for ticklabels
- get_ticklocs(self)
- Get the tick locations in data coordinates as a Numeric array
- get_ticks(self)
- grid(self, b)
- Set the axis grid on or off; b is a boolean
- is_log(self)
- Return true if log scaling is on
- pan(self, numsteps)
- Pan numticks (can be positive or negative)
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_scale(self, value)
- set_ticklabels(self, ticklabels, *args, **kwargs)
- Set the text values of the tick labels. ticklabels is a
sequence of strings. Return a list of AxisText instances
- set_ticks(self, ticks)
- Set the locations of the tick marks from sequence ticks
- zoom(self, direction)
- Zoom in/out on axis; if direction is >0 zoom in, else zoom out
Data and other attributes defined here:
- LABELPAD = -0.01
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class Legend(matplotlib.artist.Artist) |
|
Place a legend on the axes at location loc. Labels are a
sequence of strings and loc can be a string or an integer
specifying the legend location
The location codes are
'best' : 0, (currently not supported, defaults to upper right)
'upper right' : 1, (default)
'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,
Return value is a sequence of text, line instances that make
up the legend |
|
Methods defined here:
- __init__(self, axis, handles, labels, loc)
- get_child_artists(self)
- get_window_extent(self)
Data and other attributes defined here:
- AXESPAD = 0.02
- FONTSIZE = 10
- HANDLELEN = 0.050000000000000003
- HANDLETEXTSEP = 0.02
- LABELSEP = 0.0050000000000000001
- NUMPOINTS = 4
- PAD = 0.20000000000000001
- codes = {'best': 0, 'center': 10, 'center left': 6, 'center right': 7, 'lower center': 8, 'lower left': 3, 'lower right': 4, 'right': 5, 'upper center': 9, 'upper left': 2, ...}
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class Subplot(Axes) |
|
Emulate matlab's subplot command, creating axes with
Subplot(numRows, numCols, plotNum)
where plotNum=1 is the first plot number and increasing plotNums
fill rows first. max(plotNum)==numRows*numCols
You can leave out the commas if numRows<=numCols<=plotNum<10, as
in
Subplot(211) # 2 rows, 1 column, first (upper) plot |
|
- Method resolution order:
- Subplot
- Axes
- matplotlib.artist.Artist
Methods defined here:
- __init__(self, fig, *args, **kwargs)
- is_first_col(self)
- is_first_row(self)
- is_last_col(self)
- is_last_row(self)
Methods inherited from Axes:
- add_line(self, line)
- Add a line to the list of plot lines
- add_patch(self, patch)
- Add a line to the list of plot lines
- bar(self, x, y, width=0.80000000000000004, color='b', yerr=None, xerr=None, capsize=3)
- Make a bar plot with rectangles at x, x+width, 0, y
x and y are Numeric arrays
Return value is a list of Rectangle patch instances
xerr and yerr, if not None, will be used to generate errorbars
on the bar chart
- clear(self)
- cohere(self, x, y, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0)
- 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 docs for psd and csd for information
about the function arguments NFFT, detrend, windowm noverlap, as
well as the methods used to compute Pxy, Pxx and Pyy.
Returns the tuple Cxy, freqs
Refs:
Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
- csd(self, x, y, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0)
- 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. noverlap gives the length of the
overlap between segments. 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. Fs is the sampling
frequency.
NFFT must be a power of 2
detrend and window are functions, unlike in matlab where they are
vectors. For detrending you can use detrend_none, detrend_mean,
detrend_linear or a custom function. For windowing, you can use
window_none, window_hanning, or a custom function
Returns the tuple Pxy, freqs. Pxy is the cross spectrum (complex
valued), and 10*log10(|Pxy|) is plotted
Refs:
Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
- errorbar(self, x, y, yerr=None, xerr=None, fmt='b-', capsize=3)
- 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
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
Return value is a length 2 tuple. The first element is a list of
y symbol lines. The second element is a list of error bar lines.
capsize is the size of the error bar caps in points
- get_axis_bgcolor(self)
- Return the axis background color
- get_child_artists(self)
- get_xaxis(self)
- Return the XAxis instance
- get_xlim(self)
- Get the x axis range [xmin, xmax]
- get_xticklabels(self)
- Get the xtick labels as a list of AxisText instances
- get_xticks(self)
- Return the x ticks as a list of locations
- get_yaxis(self)
- Return the YAxis instance
- get_ylim(self)
- Get the y axis range [ymin, ymax]
- get_yticklabels(self)
- Get the ytick labels as a list of AxisText instances
- get_yticks(self)
- Return the y ticks as a list of locations
- grid(self, b)
- Set the axes grids on or off; b is a boolean
- hist(self, x, bins=10, normed=0)
- 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.
if noplot is True, just compute the histogram and return the
number of observations and the bins as an (n, bins) tuple.
If noplot is False, compute the histogram and plot it, returning
n, bins, patches
If normed is true, the first element of the return tuple will be the
counts normalized to form a probability distribtion, ie,
n/(len(x)*dbin)
- hlines(self, y, xmin, xmax, fmt='k-')
- 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
Returns a list of line instances that were added
- in_axes(self, xwin, ywin)
- legend(self, *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( LABELS )
>>> legend( ('label1', 'label2', 'label3') )
Make a legend for Line2D instances lines1, line2, line3
legend( LINES, LABELS )
>>> legend( (line1, line2, line3), ('label1', 'label2', 'label3') )
Make a legend at LOC
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 LOC location codes are
The location codes are
'best' : 0, (currently not supported, defaults to upper right)
'upper right' : 1, (default)
'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,
Return value is a sequence of text, line instances that make
up the legend
- loglog(self, *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
- panx(self, numsteps)
- Pan the x axis numsteps (plus pan right, minus pan left)
- pany(self, numsteps)
- Pan the x axis numsteps (plus pan up, minus pan down)
- pcolor(self, *args, **kwargs)
- pcolor(C) - make a pseudocolor plot of matrix C
pcolor(X, Y, C) - a pseudo color plot of C on the matrices X and Y
Shading:
The optional keyword arg shading ('flat' or 'faceted') will
determine whether a black grid is drawn around each pcolor
square. Default 'faceteted'
e.g.,
pcolor(C, shading='flat')
pcolor(X, Y, C, shading='faceted')
returns a list of patch objects
- plot(self, *args)
- Emulate matlab's plot command. *args is a variable length
argument, allowing for multiple x,y pairs with an optional
format string. For example, all of the following are legal,
assuming a is the Axis instance:
a.plot(x,y) # plot Numeric arrays y vs x
a.plot(x,y, 'bo') # plot Numeric arrays y vs x with blue circles
a.plot(y) # plot y using x = arange(len(y))
a.plot(y, 'r+') # ditto with red plusses
An arbitrary number of x, y, fmt groups can be specified, as in
a.plot(x1, y1, 'g^', x2, y2, 'l-')
Returns a list of lines that were added
- psd(self, x, NFFT=256, Fs=2, detrend=<function detrend_none>, window=<function window_hanning>, noverlap=0)
- 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 must be a power of 2
-- detrend and window are functions, unlike in matlab where they
are vectors. For detrending you can use detrend_none,
detrend_mean, detrend_linear or a custom function. For
windowing, you can use window_none, window_hanning, or a custom
function
-- if length x < NFFT, it will be zero padded to NFFT
Returns the tuple Pxx, freqs
For plotting, the power is plotted as 10*log10(pxx)) for decibels,
though pxx itself is returned
Refs:
Bendat & Piersol -- Random Data: Analysis and Measurement
Procedures, John Wiley & Sons (1986)
- resize(self)
- scatter(self, x, y, s=None, c='b')
- Make a scatter plot of x versus y. s is a size (in data
coords) and can be either a scalar or an array of the same
length as x or y. c is a color and can be a single color
format string or an length(x) array of intensities which will
be mapped by the colormap jet.
If size is None a default size will be used
- semilogx(self, *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
- semilogy(self, *args, **kwargs)
- Make a semilog plot with log scaling on the y axis. The args to
semilog x are the same as the args to plot. See help plot for
more info
- set_axis_bgcolor(self, color)
- set_axis_off(self)
- set_axis_on(self)
- set_title(self, label, fontdict=None, **kwargs)
- Set the title for the xaxis
See the text docstring for information of how override and the
optional args work
- set_xlabel(self, xlabel, fontdict=None, **kwargs)
- Set the label for the xaxis
See the text docstring for information of how override and the
optional args work
- set_xlim(self, v)
- Set the limits for the xaxis; v = [xmin, xmax]
- set_xscale(self, value)
- set_xticklabels(self, labels, fontdict=None, **kwargs)
- Set the xtick labels with list of strings labels
Return a list of axis text instances
- set_xticks(self, ticks)
- Set the x ticks with list of ticks
- set_ylabel(self, ylabel, fontdict=None, **kwargs)
- Set the label for the yaxis
Defaults override is
override = {
'fontsize' : 10,
'verticalalignment' : 'center',
'horizontalalignment' : 'right',
'rotation'='vertical' : }
See the text doctstring for information of how override and
the optional args work
- set_ylim(self, v)
- Set the limits for the xaxis; v = [ymin, ymax]
- set_yscale(self, value)
- set_yticklabels(self, labels, fontdict=None, **kwargs)
- Set the ytick labels with list of strings labels.
Return a list of AxisText instances
- set_yticks(self, ticks)
- Set the y ticks with list of ticks
- text(self, x, y, text, fontdict=None, **kwargs)
- Add text to axis at location x,y (data coords)
fontdict is a dictionary to override the default text properties.
If fontdict is None, the default is
If len(args) the override dictionary will be:
'fontsize' : 10,
'verticalalignment' : 'bottom',
'horizontalalignment' : 'left'
**kwargs can in turn be used to override the override, as in
a.text(x,y,label, fontsize=12)
will have verticalalignment=bottom and
horizontalalignment=left but will have a fontsize of 12
The AxisText defaults are
'color' : 'k',
'fontname' : 'Sans',
'fontsize' : 10,
'fontweight' : 'bold',
'fontangle' : 'normal',
'horizontalalignment' : 'left'
'rotation' : 'horizontal',
'verticalalignment' : 'bottom',
'transx' : self.xaxis.transData,
'transy' : self.yaxis.transData,
transx and transy specify 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
ax = subplot(111)
text(0.5, 0.5,'matplotlib',
horizontalalignment='center',
verticalalignment='center',
transx = ax.xaxis.transAxis,
transy = ax.yaxis.transAxis,
)
- update_viewlim(self)
- Update the view limits with all the data in self
- vlines(self, 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
Returns a list of lines that were added
- zoomx(self, numsteps)
- Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)
- zoomy(self, numsteps)
- Zoom in on the x xaxis numsteps (plus for zoom in, minus for zoom out)
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class Tick(matplotlib.artist.Artist) |
|
Abstract base class for the axis ticks, grid lines and labels
Publicly accessible attributes
tickline : a Line2D instance
gridline : a Line2D instance
label : an AxisText instance
gridOn : a boolean which determines whether to draw the tickline
tick1On : a boolean which determines whether to draw the 1st tickline
(left for xtick and bottom for yticks)
tick2On : a boolean which determines whether to draw the 2nd tickline
(left for xtick and bottom for yticks)
labelOn : a boolean which determines whether to draw tick label |
|
Methods defined here:
- __init__(self, axes, loc, label, size=4, gridOn=False, tick1On=True, tick2On=True, labelOn=True)
- bbox is the Bound2D bounding box in display coords of the Axes
loc is the tick location in data coords
size is the tick size in relative, axes coords
- get_child_artists(self)
- get_loc(self)
- Return the tick location (data coords) as a scalar
- set_label(self, s)
- Set the text of ticklabel in with string s
- set_loc(self, loc)
- Set the location of tick in data coords with scalar loc
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class TickLocator |
|
Try and choose intelligent locations for ticks |
|
Methods defined here:
- __init__(self, bound)
- Bound is a Bound1d instance
- get_locs(self, num)
- Return num tick locs
- get_num_hint(self, hint=5)
- Pick a number of ticks close to hint that subdivide the axis nicely
|
class XAxis(Axis) |
| |
- Method resolution order:
- XAxis
- Axis
- matplotlib.artist.Artist
Methods inherited from Axis:
- __init__(self, axes)
- Init the axis with the parent Axes instance
- autoscale_view(self)
- Try to choose the view limits intelligently
- build_artists(self)
- Call only after xaxis and yaxis have been initialized in axes
since the trasnforms require both
- format_tickval(self, x)
- Format the number x as a string
- get_child_artists(self)
- Return a list of all Artist instances contained by Axis
- get_cm_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val cm to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_gridlines()
- Return a list of Line2D for grid lines
- get_inches_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val inches to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_label(self)
- Return the axis label as an AxisText instance
- get_mm_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val mm to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_numticks(self)
- get_pts_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val points to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_ticklabels(self)
- Return a list of AxisText instances for ticklabels
- get_ticklocs(self)
- Get the tick locations in data coordinates as a Numeric array
- get_ticks(self)
- grid(self, b)
- Set the axis grid on or off; b is a boolean
- is_log(self)
- Return true if log scaling is on
- pan(self, numsteps)
- Pan numticks (can be positive or negative)
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_scale(self, value)
- set_ticklabels(self, ticklabels, *args, **kwargs)
- Set the text values of the tick labels. ticklabels is a
sequence of strings. Return a list of AxisText instances
- set_ticks(self, ticks)
- Set the locations of the tick marks from sequence ticks
- zoom(self, direction)
- Zoom in/out on axis; if direction is >0 zoom in, else zoom out
Data and other attributes inherited from Axis:
- LABELPAD = -0.01
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class XTick(Tick) |
|
Contains all the Artists needed to make an x tick - the tick line,
the label text and the grid line |
|
- Method resolution order:
- XTick
- Tick
- matplotlib.artist.Artist
Methods defined here:
- set_loc(self, loc)
- Set the location of tick in data coords with scalar loc
Methods inherited from Tick:
- __init__(self, axes, loc, label, size=4, gridOn=False, tick1On=True, tick2On=True, labelOn=True)
- bbox is the Bound2D bounding box in display coords of the Axes
loc is the tick location in data coords
size is the tick size in relative, axes coords
- get_child_artists(self)
- get_loc(self)
- Return the tick location (data coords) as a scalar
- set_label(self, s)
- Set the text of ticklabel in with string s
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class YAxis(Axis) |
| |
- Method resolution order:
- YAxis
- Axis
- matplotlib.artist.Artist
Methods inherited from Axis:
- __init__(self, axes)
- Init the axis with the parent Axes instance
- autoscale_view(self)
- Try to choose the view limits intelligently
- build_artists(self)
- Call only after xaxis and yaxis have been initialized in axes
since the trasnforms require both
- format_tickval(self, x)
- Format the number x as a string
- get_child_artists(self)
- Return a list of all Artist instances contained by Axis
- get_cm_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val cm to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_gridlines()
- Return a list of Line2D for grid lines
- get_inches_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val inches to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_label(self)
- Return the axis label as an AxisText instance
- get_mm_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val mm to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_numticks(self)
- get_pts_transform(self, offset=None, transOffset=Transform: Bound1D: 0 1 to Bound1D: 0 1)
- Transform val points to dots
offset is a RRef instance for TransformSize. if None, use
displaylim min. transOffset is a transform to transform the
offset to display coords
- get_ticklabels(self)
- Return a list of AxisText instances for ticklabels
- get_ticklocs(self)
- Get the tick locations in data coordinates as a Numeric array
- get_ticks(self)
- grid(self, b)
- Set the axis grid on or off; b is a boolean
- is_log(self)
- Return true if log scaling is on
- pan(self, numsteps)
- Pan numticks (can be positive or negative)
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_scale(self, value)
- set_ticklabels(self, ticklabels, *args, **kwargs)
- Set the text values of the tick labels. ticklabels is a
sequence of strings. Return a list of AxisText instances
- set_ticks(self, ticks)
- Set the locations of the tick marks from sequence ticks
- zoom(self, direction)
- Zoom in/out on axis; if direction is >0 zoom in, else zoom out
Data and other attributes inherited from Axis:
- LABELPAD = -0.01
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
|
class YTick(Tick) |
|
Contains all the Artists needed to make a Y tick - the tick line,
the label text and the grid line |
|
- Method resolution order:
- YTick
- Tick
- matplotlib.artist.Artist
Methods defined here:
- set_loc(self, loc)
- Set the location of tick in data coords with scalar loc
Methods inherited from Tick:
- __init__(self, axes, loc, label, size=4, gridOn=False, tick1On=True, tick2On=True, labelOn=True)
- bbox is the Bound2D bounding box in display coords of the Axes
loc is the tick location in data coords
size is the tick size in relative, axes coords
- get_child_artists(self)
- get_loc(self)
- Return the tick location (data coords) as a scalar
- set_label(self, s)
- Set the text of ticklabel in with string s
Methods inherited from matplotlib.artist.Artist:
- draw(self, drawable=None, *args, **kwargs)
- Derived classes drawing method
- get_dpi(self)
- Get the DPI of the display
- get_window_extent(self)
- Return the window extent of the Artist as a Bound2D instance
- set_child_attr(self, attr, val)
- Set attribute attr for self, and all child artists
- set_clip_on(self, b)
- Set whether artist is clipped to bbox
- 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
- set_renderer(self, renderer)
- Set the renderer
- set_transform(self, transform)
- Set the artist transform for self and all children
- wash_brushes(self)
- Erase any state vars that would impair a draw to a clean palette
Data and other attributes inherited from matplotlib.artist.Artist:
- aname = 'Artist'
| |