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

Work around the regression introduced in matplotlib 1.3.1 #274

Merged
merged 3 commits into from
Jul 7, 2014

Conversation

mstimberg
Copy link
Member

Does what I proposed in #245. Emits the following warning (will be only printed once) when the user tries to plot a quantity array (or calls ar.ravel() directly):

As a workaround for a bug in matplotlib 1.3.1, calling "ravel()" on a quantity will return unit-less values. If you get this warning during plotting, consider removing the units before plotting, e.g. by dividing by the unit. If you are explicitly calling "ravel()", consider using "flatten()" instead. The "ravel()" function will go back to returning a quantity after the matplotlib 1.4 release.

…Quantity.ravel` return a dimensionless array. Emit a warning explaining the issue. Closes #245
@thesamovar
Copy link
Member

How about making ravel() only return a unitless version if the user has matplotlib 1.3.1 installed?

@mstimberg
Copy link
Member Author

How about making ravel() only return a unitless version if the user has matplotlib 1.3.1 installed?

Good idea, I'd probably raise a warning nevertheless -- in principle a user could be calling ravel directly. And teaching them about the division by units (which also makes plotting faster) is always good :)

@thesamovar
Copy link
Member

Oh yes, I'm happy with the warning to stay.

Also, the Travis build seems to be failing.

I'll review this one later today too.

@mstimberg
Copy link
Member Author

um right, I didn't update the tests to accept a unit-less result from ravel, that's why travis is failing

@mstimberg
Copy link
Member Author

I made the change conditional on matplotlib 1.3.1 and corrected the tests, test suite should pass now.

@thesamovar
Copy link
Member

Good timing, was just about to check this. :)

@thesamovar
Copy link
Member

Tests pass here, happy to merge if Travis build passes too.

@thesamovar
Copy link
Member

OK they pass - merging now.

thesamovar added a commit that referenced this pull request Jul 7, 2014
Work around the regression introduced in matplotlib 1.3.1
@thesamovar thesamovar merged commit b781c4a into master Jul 7, 2014
@thesamovar thesamovar deleted the workaround_matplotlib_bug branch July 7, 2014 23:17
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