From 7197127abe621670d96595ac81d6bbe5301edea3 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Sun, 10 Oct 2021 13:42:45 -0400 Subject: [PATCH] Fix for regression --- src/colorbars.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 2717da5b..9a51406c 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -5,11 +5,14 @@ process_clims(s::Union{Symbol,Nothing,Missing}) = ignorenan_extrema # don't specialize on ::Function otherwise python functions won't work process_clims(f) = f -get_clims(sp::Subplot)::Tuple{Float64,Float64} = sp[:crange] -get_clims(series::Series)::Tuple{Float64,Float64} = series[:crange] +const sp_clims = Dict{Subplot, Tuple{Float64, Float64}}() +const series_clims = Dict{Series, Tuple{Float64, Float64}}() + +get_clims(sp::Subplot)::Tuple{Float64,Float64} = sp_clims[sp] +get_clims(series::Series)::Tuple{Float64,Float64} = series_clims[series] get_clims(sp::Subplot, series::Series)::Tuple{Float64,Float64} = - series[:colorbar_entry] ? sp[:crange] : series[:crange] + series[:colorbar_entry] ? sp_clims[sp] : series_clims[series] function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64,Float64} zmin, zmax = Inf, -Inf @@ -20,12 +23,11 @@ function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float6 update_clims(series, op) end end - return sp[:crange] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) + return sp_clims[sp] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end """ update_clims(::Series, op=Plots.ignorenan_extrema) - Finds the limits for the colorbar by taking the "z-values" for the series and passing them into `op`, which must return the tuple `(zmin, zmax)`. The default op is the extrema of the finite values of the input. The value is stored as a series property, which is retrieved by `get_clims`. @@ -45,7 +47,7 @@ function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64,Flo zmin, zmax = _update_clims(zmin, zmax, op(vals)...) end end - return series[:crange] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) + return series_clims[series] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end _update_clims(zmin, zmax, emin, emax) = NaNMath.min(zmin, emin), NaNMath.max(zmax, emax)