Skip to content
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

BUG: set_zlim does not set vmax as expected #3887

Closed
vdbma opened this issue Apr 5, 2022 · 2 comments · Fixed by #3888
Closed

BUG: set_zlim does not set vmax as expected #3887

vdbma opened this issue Apr 5, 2022 · 2 comments · Fixed by #3888
Assignees
Milestone

Comments

@vdbma
Copy link

vdbma commented Apr 5, 2022

Bug report

Bug summary

The actual vmax of a plot does not match the vmax specified in set_zlim.

Code for reproduction

import yt
import numpy as np

shape = (32, 16, 1)
a = np.linspace(-1, 1, 16)
b = np.ones((32, 16))
c = np.reshape(a*b, shape)
data = {("gas", "density"): c}

ds = yt.load_uniform_grid(
    data,
    shape,
    bbox=np.array([[0.0, 5.0], [0, 1], [-0.1, +0.1]]),
)
p = yt.SlicePlot(ds,"x",("gas", "density"))
p.set_zlim(("gas", "density"), -10, 10)
p.save("zmax.png")

Actual outcome

zmax

Version Information

  • Operating System: Debian 5.10.106-1 x86_64 GNU/Linux
  • Python Version: 3.9.9
  • yt version: 4.0.2 (through pip install yt)
@neutrinoceros neutrinoceros self-assigned this Apr 5, 2022
@neutrinoceros neutrinoceros added this to the 4.0.3 milestone Apr 5, 2022
@neutrinoceros
Copy link
Member

Thank you for reporting !
So, the good news is that the problem you're reporting is already fixed on the main banch (as well as on the backport branch)... the bad news is that the resulting image is now also less useful because the linthresh is autoset to zmax (or maybe -zmin)
zmax

I note that with 5e480b7 (part of the backport branch between 4.0.2 and the current tip) we get the best of both worlds

zmax

The problematic change bisects to #3859
I'll try to find a better solution that still fixes #3858 without the undesirable side effect.

@neutrinoceros
Copy link
Member

For posterity, the original bug reported here (not having a proper tick label at user-defined zmax) was fixed in #3793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants