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
Adding a title to a colorbar works fine in most cases, but misplaces the title text when using extend=max as argument to plt.colorbar().
Code for reproduction
fig, ax=plt.subplots(figsize=(6,6))
x, y, z= [np.random.random(100) foriinrange(3)]
scatter=ax.scatter(x, y, c=z)
cbar=plt.colorbar(scatter, extend="max", ax=ax)
cbar.ax.set_title("asdf")
Actual outcome
Expected outcome
I would expect the title text to be above the colorbar including the arrow. This is what happens when running the above code but without extend="max":
fig, ax=plt.subplots(figsize=(6,6))
x, y, z= [np.random.random(100) foriinrange(3)]
scatter=ax.scatter(x, y, c=z)
cbar=plt.colorbar(scatter, ax=ax)
cbar.ax.set_title("asdf")
Additional information
Aesthetically, this is less of an issue with smaller figure sizes but it should generally place the text in the right place irrespective of figure dimensions.
Operating system
No response
Matplotlib Version
3.5.1
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
No response
The text was updated successfully, but these errors were encountered:
Bug summary
Adding a title to a colorbar works fine in most cases, but misplaces the title text when using
extend=max
as argument toplt.colorbar()
.Code for reproduction
Actual outcome
Expected outcome
I would expect the title text to be above the colorbar including the arrow. This is what happens when running the above code but without
extend="max"
:Additional information
Aesthetically, this is less of an issue with smaller figure sizes but it should generally place the text in the right place irrespective of figure dimensions.
Operating system
No response
Matplotlib Version
3.5.1
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
No response
The text was updated successfully, but these errors were encountered: