matplotlib.spines
-
class matplotlib.spines.Spine(axes, spine_type, path, **kwargs)[source] -
Bases:
matplotlib.patches.PatchAn axis spine -- the line noting the data area boundaries.
Spines are the lines connecting the axis tick marks and noting the boundaries of the data area. They can be placed at arbitrary positions. See
set_positionfor more information.The default position is
('outward', 0).Spines are subclasses of
Patch, and inherit much of their behavior.Spines draw a line, a circle, or an arc depending if
set_patch_line,set_patch_circle, orset_patch_archas been called. Line-like is the default.Parameters: Other Parameters: - **kwargs
-
Valid keyword arguments are:
Property Description agg_filtera filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alphascalar or None animatedbool antialiasedor aaunknown capstyleCapStyleor {'butt', 'projecting', 'round'}clip_boxBboxclip_onbool clip_pathPatch or (Path, Transform) or None colorcolor containsunknown edgecoloror eccolor or None or 'auto' facecoloror fccolor or None figureFigurefillbool gidstr hatch{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} in_layoutbool joinstyleJoinStyleor {'miter', 'round', 'bevel'}labelobject linestyleor ls{'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidthor lwfloat or None path_effectsAbstractPathEffectpickerNone or bool or float or callable rasterizedbool sketch_params(scale: float, length: float, randomness: float) snapbool or None transformTransformurlstr visiblebool zorderfloat
-
classmethod arc_spine(axes, spine_type, center, radius, theta1, theta2, **kwargs)[source] -
Create and return an arc
Spine.
-
classmethod circular_spine(axes, center, radius, **kwargs)[source] -
Create and return a circular
Spine.
-
cla(self)[source] -
[Deprecated]
Notes
Deprecated since version 3.4:
-
clear(self)[source] -
Clear the current spine.
-
draw(self, renderer)[source] -
Draw the Artist (and its children) using the given renderer.
This has no effect if the artist is not visible (
Artist.get_visiblereturns False).Parameters: -
rendererRendererBase subclass.
Notes
This method is overridden in the Artist subclasses.
-
-
get_bounds(self)[source] -
Get the bounds of the spine.
-
get_patch_transform(self)[source] -
Return the
Transforminstance mapping patch coordinates to data coordinates.For example, one may define a patch of a circle which represents a radius of 5 by providing coordinates for a unit circle, and a transform which scales the coordinates (the patch coordinate) by 5.
-
get_path(self)[source] -
Return the path of this patch.
-
get_position(self)[source] -
Return the spine position.
-
get_spine_transform(self)[source] -
Return the spine transform.
-
get_window_extent(self, renderer=None)[source] -
Return the window extent of the spines in display space, including padding for ticks (but not their labels)
-
register_axis(self, axis)[source] -
Register an axis.
An axis should be registered with its corresponding spine from the Axes instance. This allows the spine to clear any axis properties when needed.
-
set_bounds(self, low=None, high=None)[source] -
Set the spine bounds.
Parameters: -
lowfloat or None, optional -
The lower spine bound. Passing None leaves the limit unchanged.
The bounds may also be passed as the tuple (low, high) as the first positional argument.
-
highfloat or None, optional -
The higher spine bound. Passing None leaves the limit unchanged.
-
-
set_color(self, c)[source] -
Set the edgecolor.
Parameters: -
ccolor
Notes
This method does not modify the facecolor (which defaults to "none"), unlike the
Patch.set_colormethod defined in the parent class. UsePatch.set_facecolorto set the facecolor. -
-
set_patch_arc(self, center, radius, theta1, theta2)[source] -
Set the spine to be arc-like.
-
set_patch_circle(self, center, radius)[source] -
Set the spine to be circular.
-
set_patch_line(self)[source] -
Set the spine to be linear.
-
set_position(self, position)[source] -
Set the position of the spine.
Spine position is specified by a 2 tuple of (position type, amount). The position types are:
- 'outward': place the spine out from the data area by the specified number of points. (Negative values place the spine inwards.)
- 'axes': place the spine at the specified Axes coordinate (0 to 1).
- 'data': place the spine at the specified data coordinate.
Additionally, shorthand notations define a special positions:
- 'center' -> ('axes', 0.5)
- 'zero' -> ('data', 0.0)
-
class matplotlib.spines.Spines(**kwargs)[source] -
Bases:
collections.abc.MutableMappingThe container of all
Spines in an Axes.The interface is dict-like mapping names (e.g. 'left') to
Spineobjects. Additionally it implements some pandas.Series-like features like accessing elements by attribute:spines['top'].set_visible(False) spines.top.set_visible(False)
Multiple spines can be addressed simultaneously by passing a list:
spines[['top', 'right']].set_visible(False)
Use an open slice to address all spines:
spines[:].set_visible(False)
The latter two indexing methods will return a
SpinesProxythat broadcasts allset_*calls to its members, but cannot be used for any other operation.-
classmethod from_dict(d)[source]
-
-
class matplotlib.spines.SpinesProxy(spine_dict)[source] -
Bases:
objectA proxy to broadcast
set_*method calls to all containedSpines.The proxy cannot be used for any other operations on its members.
The supported methods are determined dynamically based on the contained spines. If not all spines support a given method, it's executed only on the subset of spines that support it.
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.4.1/api/spines_api.html