8000 hexbin log scale is broken in matplotlib 1.2.0 by mdboom · Pull Request #1636 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

hexbin log scale is broken in matplotlib 1.2.0 #1636

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 3 commits into from
Jan 4, 2013

Conversation

mdboom
Copy link
Member
@mdboom mdboom commented Jan 4, 2013

Following code based on the hexbin demo on matplotlib site:

import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
n = 100000
x = np.random.standard_normal(n)
y = 2.0 + 3.0 * x + 4.0 * np.random.standard_normal(n)
y = np.power(2, y)
hexbin(x,y,yscale='log')

It produces a incorrect image on 1.2.0. When reverting hexbin implementation to that of 1.1.1 (with no other changes in 1.2.0 code) it produces a correct image.

plt111

plt120

I am using Windows 64-bit Python 2.7, with matplotlib-1.2.0.win-amd64-py2.7 package and Numpy-MKL, both from http://www.lfd.uci.edu/~gohlke/pythonlibs/. Since the revert to fix was in axes.py only I believe this was not specific to the matplotlib binary.

…rick" to reuse the polygons can't work, so revert to the old method where each polygon is independent.
@mdboom
Copy link
Member
mdboom commented Jan 4, 2013

@krakov: Which you mind testing the attached solution?

@dmcdougall
Copy link
Member

@mdboom Good response time. Your solution produces expected output on my end. There are some minor PEP8 issues which I'll comment on inline. I've also milestoned this for v1.2.x.

if xscale == 'log' or yscale == 'log':
polygons = np.expand_dims(polygon, 0) + np.expand_dims(offsets, 1)
if xscale == 'log':
polygons[:,:,0] = 10.0 ** polygons[:,:,0]
Copy link
Member

Choose a reason for hiding this comment

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

PEP8: Spaces after commas in indices.

@dmcdougall
Copy link
Member

This is utterly ludicrous. Three of the four Travis negatives were false ones. I'm starting to reconsider the usefulness of Travis recently.

The build scenarios for python versions 2.6, 2.7 and 3.1 were all false negatives.

The log hexbin test for python 3.2 failed. This doesn't look like a false negative.

@dmcdougall
Copy link
Member

The log hexbin test fails locally for me on py2.7.

@mdboom
Copy link
Member
mdboom commented Jan 4, 2013

Duh. The random number generator needs to be seeded. Following that, all is well with the tests, as far as I can tell.

@dmcdougall
Copy link
Member

Though it's probably not worth it, I'm going to hold on merging this until Travis finishes its testing.

@dmcdougall
Copy link
Member

FYI: The new log hexbin test passes locally with py2.7. Thanks for the patch @mdboom!

dmcdougall added a commit that referenced this pull request Jan 4, 2013
hexbin log scale is broken in matplotlib 1.2.0
@dmcdougall dmcdougall merged commit 084a94f into matplotlib:v1.2.x Jan 4, 2013
@mdboom mdboom deleted the hexbin-log branch August 7, 2014 13:52
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
0