Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Non string serialised projections #923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 13, 2012

Conversation

pelson
Copy link
Member

@pelson pelson commented Jun 6, 2012

This is a rebased version of #694, which itself was a rebase of #470.

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)

@@ -229,8 +229,10 @@ def __init__(self, *args, **kwargs):
each pair of data points. Set to 1 to disable
interpolation.
"""
self.resolution = kwargs.pop('resolution', 1)
self._default_theta_offset = kwargs.pop('theta_offset', 0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, currently when creating a PolarAxes with a theta_offset kwarg, Axes.__init__ uses setp to set the value, but PolarAxes.gca wipes it again. This fixes this behaviour and is tested in my new _as_mpl_axes test.

@mdboom
Copy link
Member

mdboom commented Jun 11, 2012

Barring a couple of documentation-related improvements, I think this is ready to go in.

@pelson
Copy link
Member Author

pelson commented Jun 11, 2012

I think the latest commit improves the situation. Is this the kind of thing you had in mind?

@mdboom
Copy link
Member

mdboom commented Jun 11, 2012

Much better, thanks.

@pelson
Copy link
Member Author

pelson commented Jun 11, 2012

I'll rebase now then and then give it 24 hours before merging.

pelson pushed a commit that referenced this pull request Jun 13, 2012
Support for non string projections, exposing the _as_mpl_axes external API.
@pelson pelson merged commit 1e98373 into matplotlib:master Jun 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants