Skip to content

Bug: Pie chart can't draw in jupyter

Summary

(Summarize the bug encountered concisely)

Steps to reproduce

Use pie chart in jupyter

Pie chart can be drawn using script/pdb fine

What is the current bug behavior?

See traceback

What is the expected correct behavior?

Pie charts drawn

Logs/Traceback

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/.pyenv/versions/fba/lib/python3.8/site-packages/IPython/core/formatters.py:340, in BaseFormatter.__call__(self, obj)
    338     pass
    339 else:
--> 340     return printer(obj)
    341 # Finally look for special method names
    342 method = get_real_method(obj, self.print_method)

File ~/.pyenv/versions/fba/lib/python3.8/site-packages/IPython/core/pylabtools.py:152, in print_figure(fig, fmt, bbox_inches, base64, **kwargs)
    149     from matplotlib.backend_bases import FigureCanvasBase
    150     FigureCanvasBase(fig)
--> 152 fig.canvas.print_figure(bytes_io, **kw)
    153 data = bytes_io.getvalue()
    154 if fmt == 'svg':

File ~/.pyenv/versions/fba/lib/python3.8/site-packages/matplotlib/backend_bases.py:2346, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
   2344 if bbox_inches:
   2345     if bbox_inches == "tight":
-> 2346         bbox_inches = self.figure.get_tightbbox(
   2347             renderer, bbox_extra_artists=bbox_extra_artists)
   2348         if pad_inches is None:
   2349             pad_inches = rcParams['savefig.pad_inches']

File ~/.pyenv/versions/fba/lib/python3.8/site-packages/matplotlib/figure.py:1744, in FigureBase.get_tightbbox(self, renderer, bbox_extra_artists)
   1741     artists = bbox_extra_artists
   1743 for a in artists:
-> 1744     bbox = a.get_tightbbox(renderer)
   1745     if bbox is not None:
   1746         bb.append(bbox)

File ~/.pyenv/versions/fba/lib/python3.8/site-packages/matplotlib/axes/_base.py:4408, in _AxesBase.get_tightbbox(self, renderer, call_axes_locator, bbox_extra_artists, for_layout_only)
   4405     bbox_artists = self.get_default_bbox_extra_artists()
   4407 for a in bbox_artists:
-> 4408     bbox = a.get_tightbbox(renderer)
   4409     if (bbox is not None
   4410             and 0 < bbox.width < np.inf
   4411             and 0 < bbox.height < np.inf):
   4412         bb.append(bbox)

File ~/.pyenv/versions/fba/lib/python3.8/site-packages/matplotlib/artist.py:367, in Artist.get_tightbbox(self, renderer)
    352 def get_tightbbox(self, renderer=None):
    353     """
    354     Like `.Artist.get_window_extent`, but includes any clipping.
    355 
   (...)
    365         The enclosing bounding box (in figure pixel coordinates).
    366     """
--> 367     bbox = self.get_window_extent(renderer)
    368     if self.get_clip_on():
    369         clip_box = self.get_clip_box()

File ~/.pyenv/versions/fba/lib/python3.8/site-packages/matplotlib/patches.py:604, in Patch.get_window_extent(self, renderer)
    603 def get_window_extent(self, renderer=None):
--> 604     return self.get_path().get_extents(self.get_transform())

File ~/.pyenv/versions/fba/lib/python3.8/site-packages/matplotlib/path.py:638, in Path.get_extents(self, transform, **kwargs)
    636         # as can the ends of the curve
    637         xys.append(curve([0, *dzeros, 1]))
--> 638     xys = np.concatenate(xys)
    639 if len(xys):
    640     return Bbox([xys.min(axis=0), xys.max(axis=0)])

File <__array_function__ internals>:180, in concatenate(*args, **kwargs)

ValueError: need at least one array to concatenate

<Figure size 640x480 with 17 Axes>

Possible fixes

Ruled out:

  • Dependency issues