matplotlib

Travis-CI:

Table Of Contents

Related Topics

This Page

spines

matplotlib.spines

class matplotlib.spines.Spine(axes, spine_type, path, **kwargs)

Bases: matplotlib.patches.Patch

an 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 function:set_position for more information.

The default position is ('outward',0).

Spines are subclasses of class:Patch, and inherit much of their behavior.

Spines draw a line or a circle, depending if function:set_patch_line or function:set_patch_circle has been called. Line-like is the default.

  • axes : the Axes instance containing the spine
  • spine_type : a string specifying the spine type
  • path : the path instance used to draw the spine

Valid kwargs are:

Property Description
agg_filter unknown
alpha float or None
animated [True | False]
antialiased or aa [True | False] or None for default
axes an Axes instance
bottom_margin unknown
capstyle [‘butt’ | ‘round’ | ‘projecting’]
clip_box a matplotlib.transforms.Bbox instance
clip_on [True | False]
clip_path [ (Path, Transform) | Patch | None ]
color matplotlib color spec
contains a callable function
edgecolor or ec mpl color spec, None, ‘none’, or ‘auto’
facecolor or fc mpl color spec, or None for default, or ‘none’ for no color
figure a matplotlib.figure.Figure instance
fill [True | False]
gid an id string
hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle [‘miter’ | ‘round’ | ‘bevel’]
label string or anything printable with ‘%s’ conversion.
left_margin unknown
linestyle or ls [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lw float or None for default
margins unknown
path_effects unknown
picker [None|float|boolean|callable]
rasterized [True | False | None]
right_margin unknown
sketch_params unknown
snap unknown
top_margin unknown
transform Transform instance
url a url string
visible [True | False]
zorder any number
classmethod circular_spine(axes, center, radius, **kwargs)

(staticmethod) Returns a circular Spine.

cla()

Clear the current spine

draw(artist, renderer, *args, **kwargs)
get_bounds()

Get the bounds of the spine.

get_patch_transform()
get_path()
get_position()

get the spine position

get_smart_bounds()

get whether the spine has smart bounds

get_spine_transform()

get the spine transform

is_frame_like()

return True if directly on axes frame

This is useful for determining if a spine is the edge of an old style MPL plot. If so, this function will return True.

classmethod linear_spine(axes, spine_type, **kwargs)

(staticmethod) Returns a linear Spine.

register_axis(axis)

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(low, high)

Set the bounds of the spine.

set_color(c)

Set the edgecolor.

ACCEPTS: matplotlib color arg or sequence of rgba tuples

See also

set_facecolor(), set_edgecolor()
For setting the edge or face color individually.
set_patch_circle(center, radius)

set the spine to be circular

set_patch_line()

set the spine to be linear

set_position(position)

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 specify placing the spine inward.)
  • ‘axes’ : place the spine at the specified Axes coordinate (from 0.0-1.0).
  • ‘data’ : place the spine at the specified data coordinate.

Additionally, shorthand notations define a special positions:

  • ‘center’ -> (‘axes’,0.5)
  • ‘zero’ -> (‘data’, 0.0)
set_smart_bounds(value)

set the spine and associated axis to have smart bounds