You are reading an old version of the documentation (v3.1.0). For the latest version see
Version 3.1.0
Fork me on GitHub


class mpl_toolkits.axisartist.axis_artist.AxisArtist(axes, helper, offset=None, axis_direction='bottom', **kwargs)[source]

Bases: matplotlib.artist.Artist

An artist which draws axis (a line along which the n-th axes coord is constant) line, ticks, ticklabels, and axis label.

axes : axes helper : an AxisArtistHelper instance.

ZORDER = 2.5
draw(self, renderer)[source]

Draw the axis lines, tick lines and labels


return the current axisline style.


Return axis artist helper instance.

get_tightbbox(self, renderer)[source]

Like Artist.get_window_extent, but includes any clipping.

renderer : RendererBase instance

renderer that will be used to draw the figures (i.e. fig.canvas.get_renderer())

bbox : BBox

The enclosing bounding box (in figure pixel co-ordinates).


Return the Transform instance used by this artist.

set_axis_direction(self, axis_direction)[source]

Adjust the direction, text angle, text alignment of ticklabels, labels following the matplotlib convention for the rectangle axes.

The axis_direction must be one of [left, right, bottom, top].

property left bottom right top
ticklabels location "-" "+" "+" "-"
axislabel location "-" "+" "+" "-"
ticklabels angle 90 0 -90 180
ticklabel va center baseline center baseline
ticklabel ha right center right center
axislabel angle 180 0 0 180
axislabel va center top center bottom
axislabel ha right center right center

Note that the direction "+" and "-" are relative to the direction of the increasing coordinate. Also, the text angles are actually relative to (90 + angle of the direction to the ticklabel), which gives 0 for bottom axis.

set_axislabel_direction(self, label_direction)[source]

Adjust the direction of the axislabel.

Note that the label_directions '+' and '-' are relative to the direction of the increasing coordinate.

tick_direction : {"+", "-"}
set_axisline_style(self, axisline_style=None, **kwargs)[source]

Set the axisline style.

axisline_style can be a string with axisline style name with optional

comma-separated attributes. Alternatively, the attrs can be provided as keywords.

set_axisline_style("->,size=1.5") set_axisline_style("->", size=1.5)

Old attrs simply are forgotten.

Without argument (or with arrowstyle=None), return available styles as a list of strings.

set_label(self, s)[source]

Set a label that will be displayed in the legend.

s : object

s will be converted to a string by calling str.

set_ticklabel_direction(self, tick_direction)[source]

Adjust the direction of the ticklabel.

Note that the label_directions '+' and '-' are relative to the direction of the increasing coordinate.

tick_direction : {"+", "-"}
toggle(self, all=None, ticks=None, ticklabels=None, label=None)[source]

Toggle visibility of ticks, ticklabels, and (axis) label. To turn all off,


To turn all off but ticks on

axis.toggle(all=False, ticks=True)

To turn all on but (axis) label off

axis.toggle(all=True, label=False))