You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is really a bug, or if the error is by design, but I expected matplotlib to treat the bool array as 1s and 0s without intervention.
To get the colorbar to work, I changed the array dtype from bool to int.
importmatplotlib.pyplotaspltimportnumpyasnpx=np.random.rand(10,10)
b=np.array(x>.5, dtype=int) # works as expected with this changeplt.pcolormesh(b)
plt.colorbar()
Bug report
Bug summary
The error
occurs when adding a colorbar to a pcolormesh of a Boolean array.
Code for reproduction
Actual outcome
Expected outcome
I'm not sure if this is really a bug, or if the error is by design, but I expected matplotlib to treat the bool array as 1s and 0s without intervention.
To get the colorbar to work, I changed the array dtype from
bool
toint
.Matplotlib version
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inlineMatplotlib installed via conda, default channel
Thanks for looking into this and I hope the feedback is useful.
The text was updated successfully, but these errors were encountered: