diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index c99b0771e2f1..afc5a71059e7 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4943,7 +4943,9 @@ def reduce_C_function(C: array) -> float # autoscale the norm with current accum values if it hasn't been set if norm is not None: if norm.vmin is None and norm.vmax is None: - norm.autoscale(accum) + norm.autoscale_None(accum) + norm.vmin = np.ma.masked if norm.vmin is None else norm.vmin + norm.vmax = np.ma.masked if norm.vmax is None else norm.vmax if bins is not None: if not np.iterable(bins): diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 405560d4a386..8e12cad044dc 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -901,6 +901,14 @@ def test_hexbin_empty(): ax.hexbin([], []) +@image_comparison(['hexbin_empty.png'], remove_text=True) +def test_hexbin_log_empty(): + # From #23922: creating hexbin with log scaling from empty + # dataset raises ValueError + ax = plt.gca() + ax.hexbin([], [], bins='log') + + def test_hexbin_pickable(): # From #1973: Test that picking a hexbin collection works fig, ax = plt.subplots()
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: