Skip to content
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

Correcting bad string comparsion in lin-log plot aspect verification #2603

Merged
merged 1 commit into from Nov 21, 2013

Conversation

fariza
Copy link
Member

@fariza fariza commented Nov 20, 2013

Correction to little bug in the aspect verification

If trying to plot a lin/log, it wrongly raises the following warning

matplotlib/lib/matplotlib/axes/_base.py:1148: UserWarning: aspect is not supported for Axes with xscale=linear, 
yscale=log 'yscale=%s' % (xscale, yscale))

@tacaswell
Copy link
Member

I am confused why this fixes the problem.

@efiring
Copy link
Member

efiring commented Nov 21, 2013

@tacaswell, maybe the situation can be this:

In [1]: aspect = "auto"

In [2]: aspect is "auto"
Out[2]: True

In [3]: aspect = u"auto"

In [4]: aspect is "auto"
Out[4]: False

In any case, the original comparison using is is plainly wrong.

@fariza
Copy link
Member Author

fariza commented Nov 21, 2013

Sorry but I don't get it.
Why the != operator is not correct?

@tacaswell
Copy link
Member

ah, that makes sense, forgot about unicode string.

👍 from me (I have been meaning to track this issue down for a while now, it is really annoying)

tacaswell added a commit that referenced this pull request Nov 21, 2013
Correcting bad string comparsion in lin-log plot aspect verification
@tacaswell tacaswell merged commit f8687b0 into matplotlib:master Nov 21, 2013
@fariza fariza deleted the aspect_auto_warning_bug branch November 21, 2013 03:22
@mdboom
Copy link
Member

mdboom commented Nov 21, 2013

Oh, yeah. is for string comparisons is almost never the right thing in the general case. Good catch and fix!

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.

None yet

4 participants