Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: ValueError: Unable to determine Axes to steal space for Colorbar. #23973

Closed
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/colorbar
Milestone
@janosh

Description

@janosh

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:

mpl==3 6 0

Expected outcome

Inmatplotlib==3.5.1:

mpl==3 5 1

Operating system

macOS 12.6

Matplotlib Version

3.6.0

Python version

3.10

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: color/colorbar

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp