Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: colorbar axes title clobbers extend arrow #23041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nspies-celsiustx opened this issue May 12, 2022 · 1 comment
Closed

[Bug]: colorbar axes title clobbers extend arrow #23041

nspies-celsiustx opened this issue May 12, 2022 · 1 comment

Comments

@nspies-celsiustx
Copy link

Bug summary

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) for i in range(3)]

scatter = ax.scatter(x, y, c=z)
cbar = plt.colorbar(scatter, extend="max", ax=ax)
cbar.ax.set_title("asdf")

Actual outcome

image

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) for i in range(3)]

scatter = ax.scatter(x, y, c=z)
cbar = plt.colorbar(scatter, ax=ax)
cbar.ax.set_title("asdf")

image

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

@jklymak
Copy link
Member

jklymak commented May 12, 2022

This is fixed in 3.5.2 and was closed by #22313. Sorry for the bother

@jklymak jklymak closed this as completed May 12, 2022
@QuLogic QuLogic added this to the v3.5.2 milestone May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants