Closed
Description
Bug summary
matplotlib 3.3 changed how plt.hist
handles iterables of zero-dimensional arrays. This has come up because JAX has no scalar type, and recently changed its iteration protocol to return zero-dimensional JAX arrays rather than numpy scalars (see jax-ml/jax#8899). But note that this issue can be reproduced without JAX, and is a case where matplotlib changed its behavior between version 3.2.2 and version 3.3.0.
Code for reproduction
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
data = [np.asarray(i) for i in [1, 2, 2, 3, 3, 3, 4, 4, 5]]
<
5CC1
span class="pl-s1">plt.hist(data)
plt.title(f'matplotlib version={matplotlib.__version__}')
Actual outcome
Expected outcome
I expect that version 3.3.0 and later will produce the same chart as 3.2.2 and earlier.
Additional information
No response
Operating system
No response
Matplotlib Version
3.3.0 and newer
Matplotlib Backend
No response
Python version
all Python versions
Jupyter version
No response
Installation
No response
Metadata
Metadata
Assignees
Labels
No labels