Before I dive too far down a rabbit hole, I wanted to sound out a few
questions related to adding custom Axis & associated gridlines to a
I want to be able to put an arbitrary axis on top of a plot in some
other projection (a simple, but not necessarily useful example, is a
pair Cartesian axes at the centre of a polar plot).
Some of my requirements are:
* The Axis should represent a known transform, without the transform
necessarily being transData (a non-affine transformation from the
former to the latter is known).
* The Axis is likely to be curved, and gridlines will not always
reach the edges of the background patch (I appreciate that the fact
that the gridlines not always crossing the background patch makes it
harder to identify the domain of the required Axis and accept that it
may be necessary to provide some additional information to help this
* The API should be consistent with standard mpl Axis objects (i.e.
Locators, Formatters, and all the expected control of
colour/visibility/size etc.) although access to the Axis itself is
understandably going to be different (i.e. I do not expect
ax.get_xaxis() to work).
* Features such as interactive zooming + panning should be supported.
* The Axis should be happy to live on Axes subclasses (e.g. Polar)
and "clip" the labels in the appropriate place according to the given
Axes/background-patch (in much the same way that AxisArtist can with a
* For bonus points the Axis should be able to break into multiple
lines/spines after transformation (see example 5 below for an example
of this), although this is very much a nice to have.
As far as I can see the AxisArtist toolkit is my best hope, although I
am concerned that it does not sit well with some of my requirements
(consistency of API; Axes subclass support; using transforms directly;
some bugs with non-rectilinear gridlines;).
I haven't thought about these issues in too much detail so there are
probably a whole host of problems that I have over-simplified/missed.
To aid discussion some concrete examples which demonstrate the kind of
thing that I am trying to achieve:
#1. Putting a "latitude" (y) axis on a Robinson map
(http://en.wikipedia.org/wiki/Robinson_projection) at -180 degrees
longitude and a "longitude" (x) axis on the same map at 0 degrees
#2. Putting a "longitude" (x) axis on a Robinson map which follows
the top and bottom "edge"/spine.
#3. Putting a "latitude" (y) axis on an Azimuthal equidistant map
(http://en.wikipedia.org/wiki/Azimuthal_equidistant_projection) at 0
degrees longitude and a "longitude" (x) axis on the equator (0 degrees
latitude). [Note: because of zooming, it is possible that 0 degrees
longitude may never be visible, in which case draw along the nearest
edge to the 0 degrees longitude line]
#4. Putting a "longitude" (x) axis on the outside edge of an
Azimuthal equidistant map (arbitrary zooming is allowed, hence the
"edge" may be any shape. It is sufficient to imagine it as a half
circle representing the western hemisphere).
#5. Putting a "longitude" (x) axis on a Goode homolosine map
(http://en.wikipedia.org/wiki/Goode_homolosine_projection) at -60
latitude. (this is an example of the bonus problem of splitting the
axis artists into multiple lines where appropriate!).
It appears to me that these examples are tangible, and I am fairly
confident I could draw them on a piece of paper, which suggests that
they might be achievable programatically.
I guess the questions I'm asking are:
* Is there a silver bullet which gives me this functionality already?
* If not, are my requirements so far away from matplotlib.axis.Axis /
AxisArtist that I need to consider implementing my own "Axis" artist?
* Have I missed something which makes this a far harder problem than
I am describing?
I would like to get a discussion going on this topic, so would really
appreciate posts from anyone with any insight, prior experience,
similar problems or simply general thoughts on the matter.
Many thanks in advance,