Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Labels
Milestone
Description
Bug summary
matplotlib==3.6.0
started raising an error when trying to add a colorbar toplt.hist()
:
ValueError: Unable to determine Axes to steal space for Colorbar. Either provide thecax argument to use as the Axes for the Colorbar, provide theax argument to steal space from it, or addmappable to an Axes.
Code for reproduction
importmatplotlib.pyplotaspltimportnumpyasnpxs=np.random.rand(100)_,bin_edges,bars=plt.hist(xs)color_map=getattr(plt.cm,"hot")forx_val,rectinzip(bin_edges,bars.patches):rect.set_color(color_map(x_val))cbar=plt.colorbar(plt.cm.ScalarMappable(cmap=color_map),# cax=ax.inset_axes([0.95, 0.1, 0.05, 0.8]),)
Actual outcome
Inmatplotlib==3.6.0
:
Expected outcome
Inmatplotlib==3.5.1
:
Operating system
macOS 12.6
Matplotlib Version
3.6.0
Python version
3.10
Installation
pip