Skip to content

Conversation

@pelson
Copy link
Member

@pelson pelson commented Aug 15, 2012

This PR adds an easy interface for matplotlib transform creation based on a custom object.

The syntax looks like:

class MyObject(object):
    def _as_mpl_transform(self, axes):
        return ... # a matplotlib transform instance

This interface is comprable to the _as_mpl_axes method to easily create axes from custom classes.

My primary usecase for both of these cases is to provide an interface which could do something like:

plate_carree = MyProjectionLibrary.PlateCarree()
robinson = MyProjectionLibrary.Robinson()

ax = plt.axes(projection=robinson)
plt.plot(lons, lats, transform=plate_carree)

@WeatherGod
Copy link
Member

Could this be useful for basemap? @jswhit, this PR might be of interest to you.

Copy link
Member

Choose a reason for hiding this comment

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

As per PEP8, please keep lines under 80 chars long.

@pelson
Copy link
Member Author

pelson commented Aug 20, 2012

Seems like there isn't much complaint about this PR. Anyone willing to merge?

efiring added a commit that referenced this pull request Aug 20, 2012
@efiring efiring merged commit c0ee100 into matplotlib:master Aug 20, 2012
@efiring
Copy link
Member

efiring commented Aug 20, 2012

On 2012/08/19 9:34 PM, Phil Elson wrote:

Seems like there isn't much complaint about this PR. Anyone willing to
merge?
Done.

Copy link
Member

Choose a reason for hiding this comment

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

For later cleanup, at leisure: use parentheses instead of backslash; I'm pretty sure this is supported for 2.6 and later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out this is bad. Reverted in #1176 (along with a suitable test).

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.

3 participants