desc stringlengths 3 26.7k | decl stringlengths 11 7.89k | bodies stringlengths 8 553k |
|---|---|---|
'Get the ytick lines as a list of Line2D instances'
| def get_yticklines(self):
| return cbook.silent_list('Line2D ytickline', self.yaxis.get_ticklines())
|
'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.'
| def has_data(self):
| return ((((len(self.collections) + len(self.images)) + len(self.lines)) + len(self.patches)) > 0)
|
'Add any :class:`~matplotlib.artist.Artist` to the axes'
| def add_artist(self, a):
| a.set_axes(self)
self.artists.append(a)
self._set_artist_props(a)
a.set_clip_path(self.patch)
a._remove_method = (lambda h: self.artists.remove(h))
|
'add a :class:`~matplotlib.collections.Collection` instance
to the axes'
| def add_collection(self, collection, autolim=True):
| label = collection.get_label()
if (not label):
collection.set_label(('collection%d' % len(self.collections)))
self.collections.append(collection)
self._set_artist_props(collection)
collection.set_clip_path(self.patch)
if autolim:
if (collection._paths and len(collection._paths)):... |
'Add a :class:`~matplotlib.lines.Line2D` to the list of plot
lines'
| def add_line(self, line):
| self._set_artist_props(line)
line.set_clip_path(self.patch)
self._update_line_limits(line)
if (not line.get_label()):
line.set_label(('_line%d' % len(self.lines)))
self.lines.append(line)
line._remove_method = (lambda h: self.lines.remove(h))
|
'Add a :class:`~matplotlib.patches.Patch` *p* to the list of
axes patches; the clipbox will be set to the Axes clipping
box. If the transform is not set, it will be set to
:attr:`transData`.'
| def add_patch(self, p):
| self._set_artist_props(p)
p.set_clip_path(self.patch)
self._update_patch_limits(p)
self.patches.append(p)
p._remove_method = (lambda h: self.patches.remove(h))
|
'update the data limits for patch *p*'
| def _update_patch_limits(self, patch):
| if (isinstance(patch, mpatches.Rectangle) and ((patch.get_width() == 0) or (patch.get_height() == 0))):
return
vertices = patch.get_path().vertices
if (vertices.size > 0):
xys = patch.get_patch_transform().transform(vertices)
if (patch.get_data_transform() != self.transData):
... |
'Add a :class:`~matplotlib.tables.Table` instance to the
list of axes tables'
| def add_table(self, tab):
| self._set_artist_props(tab)
self.tables.append(tab)
tab.set_clip_path(self.patch)
tab._remove_method = (lambda h: self.tables.remove(h))
|
'recompute the data limits based on current artists'
| def relim(self):
| self.dataLim.ignore(True)
self.ignore_existing_data_limits = True
for line in self.lines:
self._update_line_limits(line)
for p in self.patches:
self._update_patch_limits(p)
|
'Update the data lim bbox with seq of xy tups or equiv. 2-D array'
| def update_datalim(self, xys, updatex=True, updatey=True):
| if (iterable(xys) and (not len(xys))):
return
if (not ma.isMaskedArray(xys)):
xys = np.asarray(xys)
self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits, updatex=updatex, updatey=updatey)
self.ignore_existing_data_limits = False
|
'Update the data lim bbox with seq of xy tups'
| def update_datalim_numerix(self, x, y):
| if (iterable(x) and (not len(x))):
return
self.dataLim.update_from_data(x, y, self.ignore_existing_data_limits)
self.ignore_existing_data_limits = False
|
'Update the datalim to include the given
:class:`~matplotlib.transforms.Bbox` *bounds*'
| def update_datalim_bounds(self, bounds):
| self.dataLim.set(mtransforms.Bbox.union([self.dataLim, bounds]))
|
'look for unit *kwargs* and update the axis instances as necessary'
| def _process_unit_info(self, xdata=None, ydata=None, kwargs=None):
| if ((self.xaxis is None) or (self.yaxis is None)):
return
if (xdata is not None):
if (not self.xaxis.have_units()):
self.xaxis.update_units(xdata)
if (ydata is not None):
if (not self.yaxis.have_units()):
self.yaxis.update_units(ydata)
if (kwargs is not No... |
'return *True* if the given *mouseevent* (in display coords)
is in the Axes'
| def in_axes(self, mouseevent):
| return self.patch.contains(mouseevent)[0]
|
'Get whether autoscaling is applied on plot commands'
| def get_autoscale_on(self):
| return self._autoscaleon
|
'Set whether autoscaling is applied on plot commands
accepts: [ *True* | *False* ]'
| def set_autoscale_on(self, b):
| self._autoscaleon = b
|
'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.'
| def autoscale_view(self, tight=False, scalex=True, scaley=True):
| if (not self._autoscaleon):
return
if scalex:
xshared = self._shared_x_axes.get_siblings(self)
dl = [ax.dataLim for ax in xshared]
bb = mtransforms.BboxBase.union(dl)
(x0, x1) = bb.intervalx
if scaley:
yshared = self._shared_y_axes.get_siblings(self)
d... |
'Draw everything (plot lines, axes, labels)'
| def draw(self, renderer=None, inframe=False):
| if (renderer is None):
renderer = self._cachedRenderer
if (renderer is None):
raise RuntimeError('No renderer defined')
if (not self.get_visible()):
return
renderer.open_group('axes')
self.apply_aspect()
if (self.axison and self._frameon):
self.patch.draw(re... |
'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)'
| def draw_artist(self, a):
| assert (self._cachedRenderer is not None)
a.draw(self._cachedRenderer)
|
'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)'
| def redraw_in_frame(self):
| assert (self._cachedRenderer is not None)
self.draw(self._cachedRenderer, inframe=True)
|
'Get whether the axes rectangle patch is drawn'
| def get_frame_on(self):
| return self._frameon
|
'Set whether the axes rectangle patch is drawn
ACCEPTS: [ *True* | *False* ]'
| def set_frame_on(self, b):
| self._frameon = b
|
'Get whether axis below is true or not'
| def get_axisbelow(self):
| return self._axisbelow
|
'Set whether the axis ticks and gridlines are above or below most artists
ACCEPTS: [ *True* | *False* ]'
| def set_axisbelow(self, b):
| self._axisbelow = b
|
'call signature::
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=... | def grid(self, b=None, **kwargs):
| if len(kwargs):
b = True
self.xaxis.grid(b, **kwargs)
self.yaxis.grid(b, **kwargs)
|
'Convenience method for manipulating the ScalarFormatter
used by default for linear axes.
Optional keyword arguments:
Keyword Description
*style* [ \'sci\' (or \'scientific\') | \'plain\' ]
plain turns off scientific notation
*scilimits* (m, n), pair of integers; if *style*
is \'sci\', scientific notat... | def ticklabel_format(self, **kwargs):
| style = kwargs.pop('style', '').lower()
scilimits = kwargs.pop('scilimits', None)
if (scilimits is not None):
try:
(m, n) = scilimits
((m + n) + 1)
except (ValueError, TypeError):
raise ValueError('scilimits must be a sequence of 2 int... |
'turn off the axis'
| def set_axis_off(self):
| self.axison = False
|
'turn on the axis'
| def set_axis_on(self):
| self.axison = True
|
'Return the axis background color'
| def get_axis_bgcolor(self):
| return self._axisbg
|
'set the axes background color
ACCEPTS: any matplotlib color - see
:func:`~matplotlib.pyplot.colors`'
| def set_axis_bgcolor(self, color):
| self._axisbg = color
self.patch.set_facecolor(color)
|
'Invert the x-axis.'
| def invert_xaxis(self):
| (left, right) = self.get_xlim()
self.set_xlim(right, left)
|
'Returns True if the x-axis is inverted.'
| def xaxis_inverted(self):
| (left, right) = self.get_xlim()
return (right < left)
|
'Returns the x-axis numerical bounds where::
lowerBound < upperBound'
| def get_xbound(self):
| (left, right) = self.get_xlim()
if (left < right):
return (left, right)
else:
return (right, left)
|
'Set the lower and upper numerical bounds of the x-axis.
This method will honor axes inversion regardless of parameter order.'
| def set_xbound(self, lower=None, upper=None):
| if ((upper is None) and iterable(lower)):
(lower, upper) = lower
(old_lower, old_upper) = self.get_xbound()
if (lower is None):
lower = old_lower
if (upper is None):
upper = old_upper
if self.xaxis_inverted():
if (lower < upper):
self.set_xlim(upper, lower... |
'Get the x-axis range [*xmin*, *xmax*]'
| def get_xlim(self):
| return tuple(self.viewLim.intervalx)
|
'call signature::
set_xlim(self, *args, **kwargs)
Set the limits for the xaxis
Returns the current xlimits as a length 2 tuple: [*xmin*, *xmax*]
Examples::
set_xlim((valmin, valmax))
set_xlim(valmin, valmax)
set_xlim(xmin=1) # xmax unchanged
set_xlim(xmax=1) # xmin unchanged
Keyword arguments:
*ymin*: scalar
the min of... | def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
| if ((xmax is None) and iterable(xmin)):
(xmin, xmax) = xmin
self._process_unit_info(xdata=(xmin, xmax))
if (xmin is not None):
xmin = self.convert_xunits(xmin)
if (xmax is not None):
xmax = self.convert_xunits(xmax)
(old_xmin, old_xmax) = self.get_xlim()
if (xmin is None)... |
'call signature::
set_xscale(value)
Set the scaling of the x-axis: %(scale)s
ACCEPTS: [%(scale)s]
Different kwargs are accepted, depending on the scale:
%(scale_docs)s'
| def set_xscale(self, value, **kwargs):
| self.xaxis.set_scale(value, **kwargs)
self.autoscale_view()
self._update_transScale()
|
'Return the x ticks as a list of locations'
| def get_xticks(self, minor=False):
| return self.xaxis.get_ticklocs(minor=minor)
|
'Set the x ticks with list of *ticks*
ACCEPTS: sequence of floats'
| def set_xticks(self, ticks, minor=False):
| return self.xaxis.set_ticks(ticks, minor=minor)
|
'Get the xtick labels as a list of Text instances'
| def get_xmajorticklabels(self):
| return cbook.silent_list('Text xticklabel', self.xaxis.get_majorticklabels())
|
'Get the xtick labels as a list of Text instances'
| def get_xminorticklabels(self):
| return cbook.silent_list('Text xticklabel', self.xaxis.get_minorticklabels())
|
'Get the xtick labels as a list of Text instances'
| def get_xticklabels(self, minor=False):
| return cbook.silent_list('Text xticklabel', self.xaxis.get_ticklabels(minor=minor))
|
'call signature::
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 :class:`~matplotlib.text.Text` properties.
Valid properties are
%(Text)s
ACCEPTS: sequence of strings'
| def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs):
| return self.xaxis.set_ticklabels(labels, fontdict, minor=minor, **kwargs)
|
'Invert the y-axis.'
| def invert_yaxis(self):
| (left, right) = self.get_ylim()
self.set_ylim(right, left)
|
'Returns True if the y-axis is inverted.'
| def yaxis_inverted(self):
| (left, right) = self.get_ylim()
return (right < left)
|
'Return y-axis numerical bounds in the form of lowerBound < upperBound'
| def get_ybound(self):
| (left, right) = self.get_ylim()
if (left < right):
return (left, right)
else:
return (right, left)
|
'Set the lower and upper numerical bounds of the y-axis.
This method will honor axes inversion regardless of parameter order.'
| def set_ybound(self, lower=None, upper=None):
| if ((upper is None) and iterable(lower)):
(lower, upper) = lower
(old_lower, old_upper) = self.get_ybound()
if (lower is None):
lower = old_lower
if (upper is None):
upper = old_upper
if self.yaxis_inverted():
if (lower < upper):
self.set_ylim(upper, lower... |
'Get the y-axis range [*ymin*, *ymax*]'
| def get_ylim(self):
| return tuple(self.viewLim.intervaly)
|
'call signature::
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
Keyword arguments:
*ymin*: scalar
the min of the ylim
*ymax*: scalar
the max of the ylim
*emit*: [ T... | def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs):
| if ((ymax is None) and iterable(ymin)):
(ymin, ymax) = ymin
if (ymin is not None):
ymin = self.convert_yunits(ymin)
if (ymax is not None):
ymax = self.convert_yunits(ymax)
(old_ymin, old_ymax) = self.get_ylim()
if (ymin is None):
ymin = old_ymin
if (ymax is None):... |
'call signature::
set_yscale(value)
Set the scaling of the y-axis: %(scale)s
ACCEPTS: [%(scale)s]
Different kwargs are accepted, depending on the scale:
%(scale_docs)s'
| def set_yscale(self, value, **kwargs):
| self.yaxis.set_scale(value, **kwargs)
self.autoscale_view()
self._update_transScale()
|
'Return the y ticks as a list of locations'
| def get_yticks(self, minor=False):
| return self.yaxis.get_ticklocs(minor=minor)
|
'Set the y ticks with list of *ticks*
ACCEPTS: sequence of floats
Keyword arguments:
*minor*: [ False | True ]
Sets the minor ticks if True'
| def set_yticks(self, ticks, minor=False):
| return self.yaxis.set_ticks(ticks, minor=minor)
|
'Get the xtick labels as a list of Text instances'
| def get_ymajorticklabels(self):
| return cbook.silent_list('Text yticklabel', self.yaxis.get_majorticklabels())
|
'Get the xtick labels as a list of Text instances'
| def get_yminorticklabels(self):
| return cbook.silent_list('Text yticklabel', self.yaxis.get_minorticklabels())
|
'Get the xtick labels as a list of Text instances'
| def get_yticklabels(self, minor=False):
| return cbook.silent_list('Text yticklabel', self.yaxis.get_ticklabels(minor=minor))
|
'call signature::
set_yticklabels(labels, fontdict=None, minor=False, **kwargs)
Set the ytick labels with list of strings *labels*. Return a list of
:class:`~matplotlib.text.Text` instances.
*kwargs* set :class:`~matplotlib.text.Text` properties for the labels.
Valid properties are
%(Text)s
ACCEPTS: sequence of string... | def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs):
| return self.yaxis.set_ticklabels(labels, fontdict, minor=minor, **kwargs)
|
'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.'
| def xaxis_date(self, tz=None):
| (xmin, xmax) = self.dataLim.intervalx
if (xmin == 0.0):
dmax = today = datetime.date.today()
dmin = (today - datetime.timedelta(days=10))
self._process_unit_info(xdata=(dmin, dmax))
(dmin, dmax) = self.convert_xunits([dmin, dmax])
self.viewLim.intervalx = (dmin, dmax)
... |
'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.'
| def yaxis_date(self, tz=None):
| (ymin, ymax) = self.dataLim.intervaly
if (ymin == 0.0):
dmax = today = datetime.date.today()
dmin = (today - datetime.timedelta(days=10))
self._process_unit_info(ydata=(dmin, dmax))
(dmin, dmax) = self.convert_yunits([dmin, dmax])
self.viewLim.intervaly = (dmin, dmax)
... |
'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'
| def format_xdata(self, x):
| try:
return self.fmt_xdata(x)
except TypeError:
func = self.xaxis.get_major_formatter().format_data_short
val = func(x)
return val
|
'Return y string formatted. This function will use the
:attr:`fmt_ydata` attribute if it is callable, else will fall
back on the yaxis major formatter'
| def format_ydata(self, y):
| try:
return self.fmt_ydata(y)
except TypeError:
func = self.yaxis.get_major_formatter().format_data_short
val = func(y)
return val
|
'return a format string formatting the *x*, *y* coord'
| def format_coord(self, x, y):
| if (x is None):
x = '???'
if (y is None):
y = '???'
xs = self.format_xdata(x)
ys = self.format_ydata(y)
return ('x=%s, y=%s' % (xs, ys))
|
'Return *True* if this axes support the zoom box'
| def can_zoom(self):
| return True
|
'Get whether the axes responds to navigation commands'
| def get_navigate(self):
| return self._navigate
|
'Set whether the axes responds to navigation toolbar commands
ACCEPTS: [ True | False ]'
| def set_navigate(self, b):
| self._navigate = b
|
'Get the navigation toolbar button status: \'PAN\', \'ZOOM\', or None'
| def get_navigate_mode(self):
| return self._navigate_mode
|
'Set the navigation toolbar button status;
.. warning::
this is not a user-API function.'
| def set_navigate_mode(self, b):
| self._navigate_mode = b
|
'Called when a pan operation has started.
*x*, *y* are the mouse coordinates in display coords.
button is the mouse button number:
* 1: LEFT
* 2: MIDDLE
* 3: RIGHT
.. note::
Intended to be overridden by new projection types.'
| def start_pan(self, x, y, button):
| self._pan_start = cbook.Bunch(lim=self.viewLim.frozen(), trans=self.transData.frozen(), trans_inverse=self.transData.inverted().frozen(), bbox=self.bbox.frozen(), x=x, y=y)
|
'Called when a pan operation completes (when the mouse button
is up.)
.. note::
Intended to be overridden by new projection types.'
| def end_pan(self):
| del self._pan_start
|
'Called when the mouse moves during a pan operation.
*button* is the mouse button number:
* 1: LEFT
* 2: MIDDLE
* 3: RIGHT
*key* is a "shift" key
*x*, *y* are the mouse coordinates in display coords.
.. note::
Intended to be overridden by new projection types.'
| def drag_pan(self, button, key, x, y):
| def format_deltas(key, dx, dy):
if (key == 'control'):
if (abs(dx) > abs(dy)):
dy = dx
else:
dx = dy
elif (key == 'x'):
dy = 0
elif (key == 'y'):
dx = 0
elif (key == 'shift'):
if ((2 * abs(dx)... |
'return the cursor propertiess as a (*linewidth*, *color*)
tuple, where *linewidth* is a float and *color* is an RGBA
tuple'
| def get_cursor_props(self):
| return self._cursorProps
|
'Set the cursor property as::
ax.set_cursor_props(linewidth, color)
or::
ax.set_cursor_props((linewidth, color))
ACCEPTS: a (*float*, *color*) tuple'
| def set_cursor_props(self, *args):
| if (len(args) == 1):
(lw, c) = args[0]
elif (len(args) == 2):
(lw, c) = args
else:
raise ValueError('args must be a (linewidth, color) tuple')
c = mcolors.colorConverter.to_rgba(c)
self._cursorProps = (lw, c)
|
'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 ... | def connect(self, s, func):
| raise DeprecationWarning('use the callbacks CallbackRegistry instance instead')
|
'disconnect from the Axes event.'
| def disconnect(self, cid):
| raise DeprecationWarning('use the callbacks CallbackRegistry instance instead')
|
'return a list of child artists'
| def get_children(self):
| children = []
children.append(self.xaxis)
children.append(self.yaxis)
children.extend(self.lines)
children.extend(self.patches)
children.extend(self.texts)
children.extend(self.tables)
children.extend(self.artists)
children.extend(self.images)
if (self.legend_ is not None):
... |
'Test whether the mouse event occured in the axes.
Returns T/F, {}'
| def contains(self, mouseevent):
| if callable(self._contains):
return self._contains(self, mouseevent)
return self.patch.contains(mouseevent)
|
'call signature::
pick(mouseevent)
each child artist will fire a pick event if mouseevent is over
the artist and the artist has picker set'
| def pick(self, *args):
| if (len(args) > 1):
raise DeprecationWarning('New pick API implemented -- see API_CHANGES in the src distribution')
martist.Artist.pick(self, args[0])
|
'Return the artist under point that is closest to the *x*, *y*.
If *trans* is *None*, *x*, and *y* are in window coords,
(0,0 = lower left). Otherwise, *trans* is a
:class:`~matplotlib.transforms.Transform` that specifies the
coordinate system of *x*, *y*.
The selection of artists from amongst which the pick function
... | def __pick(self, x, y, trans=None, among=None):
| if (trans is not None):
xywin = trans.transform_point((x, y))
else:
xywin = (x, y)
def dist_points(p1, p2):
'return the distance between two points'
(x1, y1) = p1
(x2, y2) = p2
return math.sqrt((((x1 - x2) ** 2) + ((y1 - y2) ** 2)))
def dist... |
'Get the title text string.'
| def get_title(self):
| return self.title.get_text()
|
'call signature::
set_title(label, fontdict=None, **kwargs):
Set the title for the axes.
kwargs are Text properties:
%(Text)s
ACCEPTS: str
.. seealso::
:meth:`text`:
for information on how override and the optional args work'
| def set_title(self, label, fontdict=None, **kwargs):
| default = {'fontsize': rcParams['axes.titlesize'], 'verticalalignment': 'bottom', 'horizontalalignment': 'center'}
self.title.set_text(label)
self.title.update(default)
if (fontdict is not None):
self.title.update(fontdict)
self.title.update(kwargs)
return self.title
|
'Get the xlabel text string.'
| def get_xlabel(self):
| label = self.xaxis.get_label()
return label.get_text()
|
'call signature::
set_xlabel(xlabel, fontdict=None, **kwargs)
Set the label for the xaxis.
Valid kwargs are Text properties:
%(Text)s
ACCEPTS: str
.. seealso::
:meth:`text`:
for information on how override and the optional args work'
| def set_xlabel(self, xlabel, fontdict=None, **kwargs):
| label = self.xaxis.get_label()
label.set_text(xlabel)
if (fontdict is not None):
label.update(fontdict)
label.update(kwargs)
return label
|
'Get the ylabel text string.'
| def get_ylabel(self):
| label = self.yaxis.get_label()
return label.get_text()
|
'call signature::
set_ylabel(ylabel, fontdict=None, **kwargs)
Set the label for the yaxis
Valid kwargs are Text properties:
%(Text)s
ACCEPTS: str
.. seealso::
:meth:`text`:
for information on how override and the optional args work'
| def set_ylabel(self, ylabel, fontdict=None, **kwargs):
| label = self.yaxis.get_label()
label.set_text(ylabel)
if (fontdict is not None):
label.update(fontdict)
label.update(kwargs)
return label
|
'call signature::
text(x, y, s, fontdict=None, **kwargs)
Add text in string *s* to axis at location *x*, *y*, data
coordinates.
Keyword arguments:
*fontdict*:
A dictionary to override the default text properties.
If *fontdict* is *None*, the defaults are determined by your rc
parameters.
*withdash*: [ False | True ]
Cr... | def text(self, x, y, s, fontdict=None, withdash=False, **kwargs):
| default = {'verticalalignment': 'bottom', 'horizontalalignment': 'left', 'transform': self.transData}
if withdash:
t = mtext.TextWithDash(x=x, y=y, text=s)
else:
t = mtext.Text(x=x, y=y, text=s)
self._set_artist_props(t)
t.update(default)
if (fontdict is not None):
t.upda... |
'call signature::
annotate(s, xy, xytext=None, xycoords=\'data\',
textcoords=\'data\', arrowprops=None, **kwargs)
Keyword arguments:
%(Annotation)s
.. plot:: mpl_examples/pylab_examples/annotation_demo2.py'
| def annotate(self, *args, **kwargs):
| a = mtext.Annotation(*args, **kwargs)
a.set_transform(mtransforms.IdentityTransform())
self._set_artist_props(a)
if kwargs.has_key('clip_on'):
a.set_clip_path(self.patch)
self.texts.append(a)
return a
|
'call signature::
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
:... | def axhline(self, y=0, xmin=0, xmax=1, **kwargs):
| (ymin, ymax) = self.get_ybound()
yy = self.convert_yunits(y)
scaley = ((yy < ymin) or (yy > ymax))
trans = mtransforms.blended_transform_factory(self.transAxes, self.transData)
l = mlines.Line2D([xmin, xmax], [y, y], transform=trans, **kwargs)
l.x_isdata = False
self.add_line(l)
self.aut... |
'call signature::
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
:meth:`... | def axvline(self, x=0, ymin=0, ymax=1, **kwargs):
| (xmin, xmax) = self.get_xbound()
xx = self.convert_xunits(x)
scalex = ((xx < xmin) or (xx > xmax))
trans = mtransforms.blended_transform_factory(self.transData, self.transAxes)
l = mlines.Line2D([x, x], [ymin, ymax], transform=trans, **kwargs)
l.y_isdata = False
self.add_line(l)
self.aut... |
'call signature::
axhspan(ymin, ymax, xmin=0, xmax=1, **kwargs)
Axis Horizontal Span.
*y* coords are in data units and *x* coords are in axes (relative
0-1) units.
Draw a horizontal span (rectangle) from *ymin* to *ymax*.
With the default values of *xmin* = 0 and *xmax* = 1, this
always spans the xrange, regardless of ... | def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs):
| trans = mtransforms.blended_transform_factory(self.transAxes, self.transData)
self._process_unit_info([xmin, xmax], [ymin, ymax], kwargs=kwargs)
(xmin, xmax) = self.convert_xunits([xmin, xmax])
(ymin, ymax) = self.convert_yunits([ymin, ymax])
verts = ((xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax,... |
'call signature::
axvspan(xmin, xmax, ymin=0, ymax=1, **kwargs)
Axis Vertical Span.
*x* coords are in data units and *y* coords are in axes (relative
0-1) units.
Draw a vertical span (rectangle) from *xmin* to *xmax*. With
the default values of *ymin* = 0 and *ymax* = 1, this always
spans the yrange, regardless of the... | def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs):
| trans = mtransforms.blended_transform_factory(self.transData, self.transAxes)
self._process_unit_info([xmin, xmax], [ymin, ymax], kwargs=kwargs)
(xmin, xmax) = self.convert_xunits([xmin, xmax])
(ymin, ymax) = self.convert_yunits([ymin, ymax])
verts = [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax,... |
'call signature::
hlines(y, xmin, xmax, colors=\'k\', linestyles=\'solid\', **kwargs)
Plot horizontal lines at each *y* from *xmin* to *xmax*.
Returns the :class:`~matplotlib.collections.LineCollection`
that was added.
Required arguments:
*y*:
a 1-D numpy array or iterable.
*xmin* and *xmax*:
can be scalars or ``len(x)... | def hlines(self, y, xmin, xmax, colors='k', linestyles='solid', label='', **kwargs):
| if (kwargs.get('fmt') is not None):
raise DeprecationWarning('hlines now uses a collections.LineCollection and not a list of Line2D to draw; see API_CHANGES')
y = self.convert_yunits(y)
xmin = self.convert_xunits(xmin)
xmax = self.convert_xunits(xmax)
... |
'call signature::
vlines(x, ymin, ymax, color=\'k\', linestyles=\'solid\')
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*.
*... | def vlines(self, x, ymin, ymax, colors='k', linestyles='solid', label='', **kwargs):
| if (kwargs.get('fmt') is not None):
raise DeprecationWarning('vlines now uses a collections.LineCollection and not a list of Line2D to draw; see API_CHANGES')
self._process_unit_info(xdata=x, ydata=ymin, kwargs=kwargs)
x = self.convert_xunits(x)
ymin = s... |
'Plot lines and/or markers to the
:class:`~matplotlib.axes.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 default line style and color
plot(x, y, \'bo\') # plot x ... | def plot(self, *args, **kwargs):
| scalex = kwargs.pop('scalex', True)
scaley = kwargs.pop('scaley', True)
if (not self._hold):
self.cla()
lines = []
for line in self._get_lines(*args, **kwargs):
self.add_line(line)
lines.append(line)
self.autoscale_view(scalex=scalex, scaley=scaley)
return lines
|
'call signature::
plot_date(x, y, fmt=\'bo\', tz=None, xdate=True, ydate=False, **kwargs)
Similar to the :func:`~matplotlib.pyplot.plot` command, except
the *x* or *y* (or both) data is considered to be dates, and the
axis is labeled accordingly.
*x* and/or *y* can be a sequence of dates represented as float
days since... | def plot_date(self, x, y, fmt='bo', tz=None, xdate=True, ydate=False, **kwargs):
| if (not self._hold):
self.cla()
ret = self.plot(x, y, fmt, **kwargs)
if xdate:
self.xaxis_date(tz)
if ydate:
self.yaxis_date(tz)
self.autoscale_view()
return ret
|
'call signature::
loglog(*args, **kwargs)
Make a plot with log scaling on the *x* and *y* axis.
:func:`~matplotlib.pyplot.loglog` supports all the keyword
arguments of :func:`~matplotlib.pyplot.plot` and
:meth:`matplotlib.axes.Axes.set_xscale` /
:meth:`matplotlib.axes.Axes.set_yscale`.
Notable keyword arguments:
*basex... | def loglog(self, *args, **kwargs):
| if (not self._hold):
self.cla()
dx = {'basex': kwargs.pop('basex', 10), 'subsx': kwargs.pop('subsx', None)}
dy = {'basey': kwargs.pop('basey', 10), 'subsy': kwargs.pop('subsy', None)}
self.set_xscale('log', **dx)
self.set_yscale('log', **dy)
b = self._hold
self._hold = True
l = s... |
'call signature::
semilogx(*args, **kwargs)
Make a plot with log scaling on the *x* axis.
:func:`semilogx` supports all the keyword arguments of
:func:`~matplotlib.pyplot.plot` and
:meth:`matplotlib.axes.Axes.set_xscale`.
Notable keyword arguments:
*basex*: scalar > 1
base of the *x* logarithm
*subsx*: [ None | sequenc... | def semilogx(self, *args, **kwargs):
| if (not self._hold):
self.cla()
d = {'basex': kwargs.pop('basex', 10), 'subsx': kwargs.pop('subsx', None)}
self.set_xscale('log', **d)
b = self._hold
self._hold = True
l = self.plot(*args, **kwargs)
self._hold = b
return l
|
'call signature::
semilogy(*args, **kwargs)
Make a plot with log scaling on the *y* axis.
:func:`semilogy` supports all the keyword arguments of
:func:`~matplotlib.pylab.plot` and
:meth:`matplotlib.axes.Axes.set_yscale`.
Notable keyword arguments:
*basey*: scalar > 1
Base of the *y* logarithm
*subsy*: [ None | sequence... | def semilogy(self, *args, **kwargs):
| if (not self._hold):
self.cla()
d = {'basey': kwargs.pop('basey', 10), 'subsy': kwargs.pop('subsy', None)}
self.set_yscale('log', **d)
b = self._hold
self._hold = True
l = self.plot(*args, **kwargs)
self._hold = b
return l
|
'call signature::
acorr(x, normed=False, detrend=mlab.detrend_none, usevlines=False,
maxlags=None, **kwargs)
Plot the autocorrelation of *x*. If *normed* = *True*,
normalize the data by the autocorrelation at 0-th lag. *x* is
detrended by the *detrend* callable (default no normalization).
Data are plotted as ``plot(l... | def acorr(self, x, **kwargs):
| return self.xcorr(x, x, **kwargs)
|
'call signature::
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 by the cross correlation at 0-th
lag. *x* and y are detrended by the *detrend* callable
(default no normalization). *x* and *y* m... | def xcorr(self, x, y, normed=False, detrend=mlab.detrend_none, usevlines=False, maxlags=None, **kwargs):
| Nx = len(x)
if (Nx != len(y)):
raise ValueError('x and y must be equal length')
x = detrend(np.asarray(x))
y = detrend(np.asarray(y))
c = np.correlate(x, y, mode=2)
if normed:
c /= np.sqrt((np.dot(x, x) * np.dot(y, y)))
if (maxlags is None):
maxlags ... |
'call signature::
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.
To make a legend with existing lines::
legend()
:meth:`legend` by itself will try and build a legend using the label
p... | def legend(self, *args, **kwargs):
| def get_handles():
handles = self.lines[:]
handles.extend(self.patches)
handles.extend([c for c in self.collections if isinstance(c, mcoll.LineCollection)])
handles.extend([c for c in self.collections if isinstance(c, mcoll.RegularPolyCollection)])
return handles
if (len(... |
'call signature::
step(x, y, *args, **kwargs)
Make a step plot. Additional keyword args to :func:`step` are the same
as those for :func:`~matplotlib.pyplot.plot`.
*x* and *y* must be 1-D sequences, and it is assumed, but not checked,
that *x* is uniformly increasing.
Keyword arguments:
*where*: [ \'pre\' | \'post\' | \... | def step(self, x, y, *args, **kwargs):
| where = kwargs.pop('where', 'pre')
if (where not in ('pre', 'post', 'mid')):
raise ValueError("'where' argument to step must be 'pre', 'post' or 'mid'")
kwargs['linestyle'] = ('steps-' + where)
return self.plot(x, y, *args, **kwargs)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.