matplotlib

Previous topic

mpl_toolkits.axes_grid.axes_grid

Next topic

mplot3d

This Page

mpl_toolkits.axes_grid.axis_artist

class mpl_toolkits.axes_grid.axis_artist.AxisArtist(axes, helper, offset=None, axis_direction='bottom', **kw)

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.

LABELPAD None
ZORDER = 2.5
draw(artist, renderer, *args, **kwargs)

Draw the axis lines, tick lines and labels

get_axisline_style()

return the current axisline style.

get_helper()

Return axis artist helper instance.

get_tightbbox(renderer)
get_transform()
invert_ticklabel_direction()
set_axis_direction(axis_direction)

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(label_direction)

Adjust the direction of the axislabel.

ACCEPTS: [ “+” | “-” ]

Note that the label_direction ‘+’ and ‘-‘ are relative to the direction of the increasing coordinate.

set_axisline_style(axisline_style=None, **kw)

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_arrowstyle(“->,size=1.5”) set_arrowstyle(“->”, size=1.5)

Old attrs simply are forgotten.

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

set_label(s)
set_ticklabel_direction(tick_direction)

Adjust the direction of the ticklabel.

ACCEPTS: [ “+” | “-” ]

Note that the label_direction ‘+’ and ‘-‘ are relative to the direction of the increasing coordinate.

toggle(all=None, ticks=None, ticklabels=None, label=None)

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

axis.toggle(all=False)

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))
class mpl_toolkits.axes_grid.axis_artist.Ticks(ticksize, tick_out=False, **kwargs)

Ticks are derived from Line2D, and note that ticks themselves are markers. Thus, you should use set_mec, set_mew, etc.

To change the tick size (length), you need to use set_ticksize. To change the direction of the ticks (ticks are in opposite direction of ticklabels by default), use set_tick_out(False).

get_tick_out()

Return True if the tick will be rotated by 180 degree.

get_ticksize()

Return length of the ticks in points.

set_tick_out(b)

set True if tick need to be rotated by 180 degree.

set_ticksize(ticksize)

set length of the ticks in points.

class mpl_toolkits.axes_grid.axis_artist.AxisLabel(*kl, **kwargs)

Axis Label. Derived from Text. The position of the text is updated in the fly, so changing text position has no effect. Otherwise, the properties can be changed as a normal Text.

To change the pad between ticklabels and axis label, use set_pad.

get_pad()

return pad in points. See set_pad for more details.

set_axis_direction(d)

Adjust the text angle and text alignment of axis label according to the matplotlib convention.

property left bottom right top
axislabel angle 180 0 0 180
axislabel va center top center bottom
axislabel ha right center right center

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

set_pad(pad)

Set the pad in points. Note that the actual pad will be the sum of the internal pad and the external pad (that are set automatically by the AxisArtist), and it only set the internal pad

class mpl_toolkits.axes_grid.axis_artist.TickLabels(**kwargs)

Tick Labels. While derived from Text, this single artist draws all ticklabels. As in AxisLabel, the position of the text is updated in the fly, so changing text position has no effect. Otherwise, the properties can be changed as a normal Text. Unlike the ticklabels of the mainline matplotlib, properties of single ticklabel alone cannot modified.

To change the pad between ticks and ticklabels, use set_pad.

get_texts_widths_heights_descents(renderer)

return a list of width, height, descent for ticklabels.

set_axis_direction(label_direction)

Adjust the text angle and text alignment of ticklabels according to the matplotlib convention.

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

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

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