diff --git a/ultraplot/axes/plot.py b/ultraplot/axes/plot.py index 3f29d190b..df902902e 100644 --- a/ultraplot/axes/plot.py +++ b/ultraplot/axes/plot.py @@ -2707,13 +2707,6 @@ def _parse_cmap( # Create the continuous normalizer. norm = _not_none(norm, "div" if "diverging" in trues else "linear") - # If using a diverging norm, fair=True, and vcenter not set, default to midpoint - if norm in ("div", "diverging") or "diverging" in trues: - fair = norm_kw.get("fair", True) # defaults to True - vcenter = norm_kw.get("vcenter", 0) - if fair and vcenter is None and vmin is not None and vmax is not None: - vcenter = 0.5 * (vmin + vmax) - norm_kw["vcenter"] = vcenter if isinstance(norm, mcolors.Normalize): norm.vmin, norm.vmax = vmin, vmax else: @@ -2946,6 +2939,7 @@ def _parse_level_lim( f"Incompatible arguments vmin={vmin!r}, vmax={vmax!r}, and " "symmetric=True. Ignoring the latter." ) + return vmin, vmax, kwargs def _parse_level_num( diff --git a/ultraplot/tests/test_color.py b/ultraplot/tests/test_color.py deleted file mode 100644 index 61e83a464..000000000 --- a/ultraplot/tests/test_color.py +++ /dev/null @@ -1,37 +0,0 @@ -import ultraplot as uplt, numpy as np, pytest - - -@pytest.mark.mpl_image_compare -def test_vcenter_values(): - """ - Test that vcenter values are correctly set in colorbars. - """ - rng = np.random.default_rng(seed=10) - mvals = rng.normal(size=(32, 32)) - cmap = "spectral" - # The middle and right plot should look the same - # The colors should spread out where the extremes are visible - fig, axs = uplt.subplots(ncols=3, share=0) - for i, ax in enumerate(axs): - specs = {} - if i > 0: - vmin = -0.2 - vmax = 2.0 - specs = dict(vmin=vmin, vmax=vmax) - if i == 2: - mvals = np.clip(mvals, vmin, vmax) - m = ax.pcolormesh( - mvals, - cmap=cmap, - discrete=False, - **specs, - ) - ax.format( - grid=False, - xticklabels=[], - xticks=[], - yticklabels=[], - yticks=[], - ) - ax.colorbar(m, loc="r", label=f"{i}") - return fig