Skip to content

[Bug]: SymLogNorm not working properly #22870

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
oscargus opened this issue Apr 21, 2022 · 3 comments
Closed

[Bug]: SymLogNorm not working properly #22870

oscargus opened this issue Apr 21, 2022 · 3 comments

Comments

@oscargus
Copy link
Member

oscargus commented Apr 21, 2022

Bug summary

(It is, sort of, well known that this is broken, see e.g. #16398, but good to have a separate issue for it in case someone is tempted to give it a go.)
Here is an example for a colorbar, but a similar behavior is seen elsewhere:

N = 100
X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2
fig, ax = plt.subplots(2, 1)
pcm = ax[0].pcolormesh(X, Y, Z,
norm=colors.SymLogNorm(linthresh=0.03, linscale=0.03,
vmin=-1.0, vmax=1.0, base=10),
cmap='RdBu_r', shading='auto')
fig.colorbar(pcm, ax=ax[0], extend='both')
pcm = ax[1].pcolormesh(X, Y, Z, cmap='RdBu_r', vmin=-np.max(Z), shading='auto')
fig.colorbar(pcm, ax=ax[1], extend='both')
plt.show()

gives

image

As seen, the top colorbar has a messed scale.

Code for reproduction

See above.

Actual outcome

Overlapping tick labels.

Expected outcome

Non-overlapping tick labels.

Additional information

No response

Operating system

No response

Matplotlib Version

Current main (pre-3.6.0)

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

No response

@jklymak
Copy link
Member

jklymak commented Apr 21, 2022

I don't think this is a colorbar issue in particular. Don't you get the same with any symlognorm axis?

@oscargus
Copy link
Member Author

You are probably right. Just saw it there. I'll edit appropriately.

@oscargus oscargus changed the title [Bug]: SymLogNorm not working with (at least) colorbar [Bug]: SymLogNorm not working properly Apr 21, 2022
@oscargus
Copy link
Member Author

And then I found an issue searching for SymmetricalLogLocator instead (not sure where the actual error is, but in one of those most likely). #18757

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

2 participants