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: symlog colorbar minor ticks are not drawn when vmax and vmin are both strictly negative #3560

Closed
neutrinoceros opened this issue Oct 13, 2021 · 0 comments · Fixed by #3556
Milestone

Comments

@neutrinoceros
Copy link
Member

Bug report

Bug summary

Similar to #3535, but specifically for the case vmax and vmin are both strictly negative

Code for reproduction
Using matplotlib 3.5.0rc1

import yt

ds = yt.testing.fake_amr_ds(fields=[("gas", "density")], units=["g/cm**3"], geometry="polar")
yt.testing.add_noise_fields(ds)
p = yt.SlicePlot(ds, "z", "noise2")

p.save(f"/tmp/")

and using this temporary patch to make it testable before 3.5.0 final is released

diff --git a/yt/visualization/plot_window.py b/yt/visualization/plot_window.py
index 53a1fe9ad..4a78ef179 100644
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1223,7 +1223,7 @@ class PWViewerMPL(PlotWindow):
                     self.plots[f].cax.minorticks_on()

                 elif self._field_transform[f] == symlog_transform:
-                    if Version("3.2.0") <= MPL_VERSION < Version("3.5.0"):
+                    if Version("3.2.0") <= MPL_VERSION < Version("3.5.0b"):
                         # no known working method to draw symlog minor ticks
                         # see https://github.com/yt-project/yt/issues/3535
                         pass
@@ -1232,7 +1232,7 @@ class PWViewerMPL(PlotWindow):
                             np.log10(self.plots[f].cb.norm.linthresh)
                         )
                         mticks = get_symlog_minorticks(flinthresh, vmin, vmax)
-                        if MPL_VERSION < Version("3.5.0"):
+                        if MPL_VERSION < Version("3.5.0b"):
                             # https://github.com/matplotlib/matplotlib/issues/21258
                             mticks = self.plots[f].image.norm(mticks)
                         self.plots[f].cax.yaxis.set_ticks(mticks, minor=True)

Actual outcome
cb_mpl_v3 4 3_Slice_z_noise2

Expected outcome
cb_mpl_v3 5 0rc1_Slice_z_noise2

(minor ticks are drawn)

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

Successfully merging a pull request may close this issue.

1 participant