mpl_toolkits.axisartist.axislines#

Axislines includes modified implementation of the Axes class. The biggest difference is that the artists responsible for drawing the axis spine, ticks, ticklabels and axis labels are separated out from Matplotlib's Axis class. Originally, this change was motivated to support curvilinear grid. Here are a few reasons that I came up with a new axes class:

  • "top" and "bottom" x-axis (or "left" and "right" y-axis) can have different ticks (tick locations and labels). This is not possible with the current Matplotlib, although some twin axes trick can help.

  • Curvilinear grid.

  • angled ticks.

In the new axes class, xaxis and yaxis is set to not visible by default, and new set of artist (AxisArtist) are defined to draw axis line, ticks, ticklabels and axis label. Axes.axis attribute serves as a dictionary of these artists, i.e., ax.axis["left"] is a AxisArtist instance responsible to draw left y-axis. The default Axes.axis contains "bottom", "left", "top" and "right".

AxisArtist can be considered as a container artist and has the following children artists which will draw ticks, labels, etc.

  • line

  • major_ticks, major_ticklabels

  • minor_ticks, minor_ticklabels

  • offsetText

  • label

Note that these are separate artists from matplotlib.axis.Axis, thus most tick-related functions in Matplotlib won't work. For example, color and markerwidth of the ax.axis["bottom"].major_ticks will follow those of Axes.xaxis unless explicitly specified.

In addition to AxisArtist, the Axes will have gridlines attribute, which obviously draws grid lines. The gridlines needs to be separated from the axis as some gridlines can never pass any axis.

Classes#

Axes(*args[, grid_helper])

Build an Axes in a figure.

AxesZero(*args[, grid_helper])

Build an Axes in a figure.

AxisArtistHelper()

AxisArtistHelperRectlinear()

FixedAxisArtistHelperRectilinear(axes, loc)

nth_coord = along which coordinate value varies in 2D, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis

FloatingAxisArtistHelperRectilinear(axes, ...)

GridHelperBase()

GridHelperRectlinear(axes)

Subplot

alias of Axes

SubplotZero

alias of AxesZero