Version 3.0.2
matplotlib
Fork me on GitHub

Table of Contents

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 mpl'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 mpl, 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 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 Axis class of the original mpl, thus most of tick-related command in the original mpl won't work, although some effort has made to work with. 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])
AxesZero(*args[, grid_helper])
AxisArtistHelper AxisArtistHelper should define following method with given APIs.
AxisArtistHelperRectlinear
GridHelperBase()
GridHelperRectlinear(axes)
SimpleChainedObjects(objects)