astrofrog / mpl-scatter-density

:zap: Fast scatter density plots for Matplotlib :zap:
BSD 2-Clause "Simplified" License
497 stars 25 forks source link

Examples do not work in the jupyter notebook #7

Closed lbignone closed 7 years ago

lbignone commented 7 years ago

Very interesting mini module. Thank you for this.

Examples do not appear to work in the jupyter notebook. I had no problem executing them in the ipython shell

Here is the traceback (Jupyter 5.0.0, python 3.6.1, ipython 5.3.0):

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/usr/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
    305                 pass
    306             else:
--> 307                 return printer(obj)
    308             # Finally look for special method names
    309             method = get_real_method(obj, self.print_method)

/usr/lib/python3.6/site-packages/IPython/core/pylabtools.py in <lambda>(fig)
    238 
    239     if 'png' in formats:
--> 240         png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
    241     if 'retina' in formats or 'png2x' in formats:
    242         png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))

/usr/lib/python3.6/site-packages/IPython/core/pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
    122 
    123     bytes_io = BytesIO()
--> 124     fig.canvas.print_figure(bytes_io, **kw)
    125     data = bytes_io.getvalue()
    126     if fmt == 'svg':

/usr/lib/python3.6/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
   2208                 bbox_filtered = []
   2209                 for a in bbox_artists:
-> 2210                     bbox = a.get_window_extent(renderer)
   2211                     if a.get_clip_on():
   2212                         clip_box = a.get_clip_box()

/usr/lib/python3.6/site-packages/matplotlib/image.py in get_window_extent(self, renderer)
    755 
    756     def get_window_extent(self, renderer=None):
--> 757         x0, x1, y0, y1 = self._extent
    758         bbox = Bbox.from_extents([x0, y0, x1, y1])
    759         return bbox.transformed(self.axes.transData)

TypeError: 'NoneType' object is not iterable
astrofrog commented 7 years ago

@lbignone - thanks for the report, I hadn't tested it yet in the notebook. Can you provide the code you used to get the above traceback?

astrofrog commented 7 years ago

@lbignone - I found the issue and am fixing it in https://github.com/astrofrog/mpl-scatter-density/pull/8

astrofrog commented 7 years ago

@lbignone - I've merged the fix and released v0.2. Can you confirm that this is now fixed for you?

lbignone commented 7 years ago

I can confirm all examples in the README work in my notebook