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

Does not work with inline matplotlib on Jupyter-Notebooks #15

Open
ijoseph opened this issue Apr 20, 2018 · 3 comments
Open

Does not work with inline matplotlib on Jupyter-Notebooks #15

ijoseph opened this issue Apr 20, 2018 · 3 comments
Labels

Comments

@ijoseph
Copy link

ijoseph commented Apr 20, 2018

MWE:

In a Jupyter Notebook,

%matplotlib inline

import mpl_scatter_density

import numpy as np

import matplotlib.pyplot as plt

N = 10000000
x = np.random.normal(4, 2, N)
y = np.random.normal(3, 1, N)

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='scatter_density')
ax.scatter_density(x, y)
ax.set_xlim(-5, 10)
ax.set_ylim(-5, 10)

throws TypeError: 'NoneType' object is not iterable.

Using Jupyter Notebook version 5.0.0, matplotlib version 2.1.0 on Google Chrome on MacOS 10.13.4.

However, works fine with %matplotlib notebook.

@astrofrog astrofrog added the bug label Apr 22, 2018
@FedericoV
Copy link

Not very elegant, but this fixes it:

hist = ax.scatter_density(x, y)
hist.set_extent(hist.get_extent())

@ijoseph
Copy link
Author

ijoseph commented Jun 18, 2018

Welp, that definitely isn't elegant (seems like the coding equivalent of a mathematical tautology), yet it does work! Fantastic. Thank you.

@ijoseph
Copy link
Author

ijoseph commented Jun 19, 2018

Wow, this is so good. seaborn's hexgrid is a joke, comparatively, in terms of both speed and informativeness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants