Initialising projections in matplotlib

Hi,
I would like the ability to setup a plot projection in MPL that can be defined by various parameters and does not need to be serialised as a string and registered with matplotlib.projections.register_projection. For example, an extension of /examples/api/custom_projection_example.py might be to add the ability to define the central meridian to an arbitrary value rather than the current value of 0 - in this case I would expect to define the projection by creating an object which can then be turned into a matplotlib axes:

hammer_proj = Hammer(central_meridian=45)
ax = plt.subplot(111, projection=hammer_proj)

I have made a change to matplotlib which would enable this capability, which can be found at https://github.com/PhilipElson/matplotlib/commit/9c7b1b27d0245a752d010bd03ae66dc6c000d8e499 . Any feedback and thoughts would be really appreciated with the ultimate goal of getting this functionality into MPL.

Many Thanks,

Philip

I'm getting a 404 error when I try that URL. The preferred method of
contribution is to submit a pull request

http://matplotlib.sourceforge.net/devel/gitwash/development_workflow.html#asking-for-your-changes-to-be-merged-into-the-main-repo

···

On Thu, Sep 15, 2011 at 1:19 PM, Phil Elson <philipelson@...476...> wrote:

I have made a change to matplotlib which would enable this capability, which
can be found at
https://github.com/PhilipElson/matplotlib/commit/9c7b1b27d0245a752d010bd03ae66dc6c000d8e499
. Any feedback and thoughts would be really appreciated with the ultimate
goal of getting this functionality into MPL.

Sorry, that link was bad, it should have read:

https://github.com/PhilipElson/matplotlib/commit/9c7b1b27d0245a752d010bd03ae66dc6c000d8e4

···

To: matplotlib-devel@lists.sourceforge.net
Date: Thu, 15 Sep 2011 18:19:49 +0000
Subject: [matplotlib-devel] Initialising projections in matplotlib

Hi,
I would like the ability to setup a plot projection in MPL that can be defined by various parameters and does not need to be serialised as a string and registered with matplotlib.projections.register_projection. For example, an extension of /examples/api/custom_projection_example.py might be to add the ability to define the central meridian to an arbitrary value rather than the current value of 0 - in this case I would expect to define the projection by creating an object which can then be turned into a matplotlib axes:

hammer_proj = Hammer(central_meridian=45)
ax = plt.subplot(111, projection=hammer_proj)

I have made a change to matplotlib which would enable this capability, which can be found at https://github.com/PhilipElson/matplotlib/commit/9c7b1b27d0245a752d010bd03ae66dc6c000d8e499 . Any feedback and thoughts would be really appreciated with the ultimate goal of getting this functionality into MPL.

Many Thanks,

Philip


Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/


Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net

Hmm, interesting idea. I took a quick look through the code, and it touches on some fragile parts of axes.py, so I wouldn’t be comfortable with this being in v1.1.0, but I think it is definitely worthy of further investigation.

As a bit of a selfish interest, I think your approach might open up a possible approach for a long-standing problem of mine with 3d projections. Axes3D objects want to fill its entire plot box, but when created through a subplot mechanism, the defaults get over-ridden. I wonder if this approach with _init_axes() passing kwargs might provide me with the hook to fix this.

Ben Root

···

On Thu, Sep 15, 2011 at 1:19 PM, Phil Elson <philipelson@…744…76…> wrote:

Hi,
I would like the ability to setup a plot projection in MPL that can be defined by various parameters and does not need to be serialised as a string and registered with matplotlib.projections.register_projection. For example, an extension of /examples/api/custom_projection_example.py might be to add the ability to define the central meridian to an arbitrary value rather than the current value of 0 - in this case I would expect to define the projection by creating an object which can then be turned into a matplotlib axes:

hammer_proj = Hammer(central_meridian=45)
ax = plt.subplot(111, projection=hammer_proj)

I have made a change to matplotlib which would enable this capability, which can be found at https://github.com/PhilipElson/matplotlib/commit/9c7b1b27d0245a752d010bd03ae66dc6c000d8e499 . Any feedback and thoughts would be really appreciated with the ultimate goal of getting this functionality into MPL.

Many Thanks,

Philip

As a bit of a selfish interest, I think your approach might open up a possible approach for a long-standing problem
of mine with 3d projections. Axes3D objects >> want to fill its entire plot box, but when created through a subplot
mechanism, the defaults get over-ridden. I wonder if this approach with _init_axes() passing kwargs might
provide me with the hook to fix this.
Yes, having the _init_axes method makes subclassing then initialising an Axes much easier, and avoids the need to make an intermediate class for each Axes construction.
Hmm, interesting idea. I took a quick look through the code, and it touches on some fragile parts of axes.py, so I wouldn’t be
comfortable with this being in v1.1.0, but I think it is definitely worthy of further investigation.
I was wondering if you see axes.py changing significantly in the near future? If not then it would seem a shame to hold back this relatively small change for something not yet in the pipeline.
Perhaps you could elaborate on what you feel to be the more fragile aspects and we could start to look to resolve these as a seperate development activity?

Thanks again,