Skip to content

Deprecated the set_colorbar method on a scalar mappable. #2055

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 2 commits into from
May 24, 2013

Conversation

pelson
Copy link
Member

@pelson pelson commented May 23, 2013

No description provided.

'set the colorbar image and axes associated with mappable'
self.colorbar = im, ax
"""set the colorbar and axes instances associated with mappable"""
self.colorbar = im
Copy link
Member

Choose a reason for hiding this comment

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

I must have missed some other PR... there weren't any old code that would have queried and expected a tuple from the colorbar attribute, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. I don't think anything is making use of it (at least, there are no tests which exercise it, and a thorough grepping didn't throw anything up)

@efiring
Copy link
Member

efiring commented May 23, 2013

It looks like part of the point here is that a colorbar always has an axes attribute, so there is no need for a tuple in the ScalarMappable colorbar attribute.

Looks like a good cleanup--but it is a bit dangerous, and I don't know how to handle that. The danger, of course, is that some user code is expecting the attribute to hold a tuple. Maybe it will be adequate to simply flag this prominently in the description of API changes.

@pelson
Copy link
Member Author

pelson commented May 24, 2013

Looks like a good cleanup--but it is a bit dangerous, and I don't know how to handle that. The danger, of course, is that some user code is expecting the attribute to hold a tuple. Maybe it will be adequate to simply flag this prominently in the description of API changes.

Agreed. Indeed I have code which does cb = scalarmappable.colorbar[0]. But I'm prepared to accept the fact that this is a backwards incompatible change - having anything but a colorbar instance in a colorbar attribute is just wrong. An api_changes.rst entry is the best I can come up with too - but I think this attribute is sufficiently opaque that you would only know about it if you read the source code of cm.ScalarMappable.

@pelson
Copy link
Member Author

pelson commented May 24, 2013

Think this is good to go.

mdboom added a commit that referenced this pull request May 24, 2013
Deprecated the set_colorbar method on a scalar mappable.
@mdboom mdboom merged commit 148ed82 into matplotlib:master May 24, 2013
of ``(colorbar_instance, colorbar_axes)`` but is now just
``colorbar_instance``. To get the colorbar axes it is possible to just use
the :attr:`~matplotlib.colorbar.ColorbarBase.ax` attribute on a colorbar
isntance.
Copy link
Member Author

Choose a reason for hiding this comment

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

Ah. Sorry - typo.

Copy link
Member

Choose a reason for hiding this comment

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

No worries. We can just push that fix directly to master.

@dmcdougall
Copy link
Member

As a note, since this is a backwards incompatible change, should the next version number be 2.0.x?

@mdboom
Copy link
Member

mdboom commented Jun 24, 2013

Since 1.0, we have allowed backward incompatible changes of this magnitude for minor point releases, with a note in api_changes.rst and a deprecation process when necessary. So I don't think this requires 2.0.x. I think we should save that for the time when a significant portion of user code would require changes -- this is a bit of a corner case.

tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Jan 10, 2015
tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Jan 10, 2015
tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Jan 10, 2015
tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Jan 11, 2015
tacaswell added a commit to tacaswell/matplotlib that referenced this pull request Jan 22, 2015
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.

5 participants