Closed
Description
Calling ax.pie() with all-zero data leads to an internal NaN→int conversion failure, rather than a clean “all zero input” error or an empty plot.
Reproducible example
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.pie([0, 0], labels=["A", "B"])
fig.savefig("out.png")`
Traceback
RuntimeWarning: invalid value encountered in divide
x = x / sx
...
File ".../matplotlib/axes/_axes.py", line 3409, in pie
w = mpatches.Wedge((x, y), radius, 360. * min(theta1, theta2),
...
File ".../matplotlib/patches.py", line 1264, in _recompute_path
arc = Path.arc(theta1, theta2)
File ".../matplotlib/path.py", line 961, in arc
n = int(2 ** np.ceil((eta2 - eta1) / halfpi))
ValueError: cannot convert float NaN to integer
Expected behavior
Either:
Render an empty/placeholder pie when slice‐sizes sum to zero
Or raise a clear ValueError("All wedge sizes zero") before entering the NaN conversion