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

Skip to content

Added warnings for easily confusible subplot/subplots invokations #898

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
Jul 18, 2012

Conversation

WeatherGod
Copy link
Member

such as::

subplots(1, 2, 1) and subplot(1, 2, False).

# sharex.
if not isinstance(sharex, bool) :
warnings.warn("sharex argument to subplots() was not boolean."
" Did you intend to use subplot()?")
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we make this a DeprecationWarning -- indicating that it may become an exception in the future and the user is encouraged to change their code. (And same for the warning above).

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I agree that this is a deprecation warning (which is hidden by default since python 2.7). It is not the case that this functionality used to work and some structural/procedural change it will mean it will removed in future versions; instead it is a warning to a user to tell them that what they have passed as arguments indicates that they are probably doing the wrong thing.

Copy link
Member

Choose a reason for hiding this comment

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

Yes -- but in the future we may not want to let them do the wrong thing and turn this into an exception -- therefore I think a DeprecationWarning might be appropriate.

@pelson
Copy link
Member

pelson commented Jun 20, 2012

#880 is relevant to this issue too.
@WeatherGod would you be prepared to add an explicit check on the type of the incoming args in the case of both subplot(x) and subplot(x, y, z) such that x, y and z must all be ints or np.ints?

@pelson
Copy link
Member

pelson commented Jun 20, 2012

This has my +1.

@WeatherGod
Copy link
Member Author

I think I have to rework this code anyway so that it will be put in when pyplot.py gets generated automatically

@pelson
Copy link
Member

pelson commented Jul 5, 2012

@WeatherGod: Any update? We may as well put this issue to bed sooner rather than later.

@WeatherGod
Copy link
Member Author

Hmmm, my rebase attempts seemed to be bringing in lots of other stuff. It would probably be better to simply make a new PR.

@pelson
Copy link
Member

pelson commented Jul 6, 2012

Agreed. This PR should not be merged in its current state as there are changes in the diffs that are not intended to be part of this PR. Strange that it would merge so strangely.

@WeatherGod
Copy link
Member Author

And I think I fixed the bad rebase. Don't know how that happened, but the commit list now looks reasonable.

@WeatherGod
Copy link
Member Author

Anybody want to merge this, go ahead. Merging my own PR is bad style.

pelson added a commit that referenced this pull request Jul 18, 2012
Added warnings for easily confusible subplot/subplots invocations
@pelson pelson merged commit 1ee7e7b into matplotlib:master Jul 18, 2012
@pelson
Copy link
Member

pelson commented Jul 18, 2012

Anybody want to merge this, go ahead. Merging my own PR is bad style.

Just remember who did the merge when I need such a favour! ;-)

@WeatherGod WeatherGod deleted the subplot_warn branch July 23, 2014 12:56
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