From 25eebcbe1a976528f180bf5b8e020c69d830ad24 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Wed, 22 Sep 2021 03:17:50 -0400 Subject: [PATCH 01/17] For Shape type, cut off process --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 80726af72..7f0785b5f 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -8,7 +8,7 @@ process_clims(f) = f function get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = Inf, -Inf for series in series_list(sp) - if series[:colorbar_entry] + if series[:colorbar_entry] && (series[:seriestype] != :shape || series[:fillcolor] === nothing) zmin, zmax = _update_clims(zmin, zmax, get_clims(series, op)...) end end From ce5759923a8307bc80c44806c49c251f41ab88f3 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Wed, 22 Sep 2021 03:21:22 -0400 Subject: [PATCH 02/17] Remove fillcolor for now --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 7f0785b5f..c2de5fb9d 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -8,7 +8,7 @@ process_clims(f) = f function get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = Inf, -Inf for series in series_list(sp) - if series[:colorbar_entry] && (series[:seriestype] != :shape || series[:fillcolor] === nothing) + if series[:colorbar_entry] && series[:seriestype] != :shape zmin, zmax = _update_clims(zmin, zmax, get_clims(series, op)...) end end From 4787c1cbd688f84d1d333910dc427d361aa66537 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Wed, 22 Sep 2021 12:00:48 -0400 Subject: [PATCH 03/17] Address type inference failure instead --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index c2de5fb9d..80726af72 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -8,7 +8,7 @@ process_clims(f) = f function get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = Inf, -Inf for series in series_list(sp) - if series[:colorbar_entry] && series[:seriestype] != :shape + if series[:colorbar_entry] zmin, zmax = _update_clims(zmin, zmax, get_clims(series, op)...) end end From abc8510401c499fe046f903b61adeedd41503e34 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Wed, 22 Sep 2021 17:04:33 -0400 Subject: [PATCH 04/17] Store value instead of re-evaluating --- src/colorbars.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 80726af72..f24a1fe37 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -12,12 +12,14 @@ function get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, zmin, zmax = _update_clims(zmin, zmax, get_clims(series, op)...) end end + return zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = if series[:colorbar_entry] - get_clims(sp, op) + clims = _update_clims(get(sp, :colorbar_limits, (Inf, -Inf))..., get_clims(series, op)...) + sp[:colorbar_limits] = clims else get_clims(series, op) end From 55afe780a2830e117e9382f0100eca3b76c310ee Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 13:19:05 -0400 Subject: [PATCH 05/17] Works, but not ideal --- src/colorbars.jl | 6 ++++-- src/pipeline.jl | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index f24a1fe37..a0ce361c7 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -5,7 +5,7 @@ process_clims(s::Union{Symbol,Nothing,Missing}) = ignorenan_extrema # don't specialize on ::Function otherwise python functions won't work process_clims(f) = f -function get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} +function update_clims(sp::Subplot, op = process_clims(sp[:clims])) zmin, zmax = Inf, -Inf for series in series_list(sp) if series[:colorbar_entry] @@ -13,9 +13,11 @@ function get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, end end - return zmin <= zmax ? (zmin, zmax) : (NaN, NaN) + sp[:colorbar_limits] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end +get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} = sp[:colorbar_limits] + function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = if series[:colorbar_entry] clims = _update_clims(get(sp, :colorbar_limits, (Inf, -Inf))..., get_clims(series, op)...) diff --git a/src/pipeline.jl b/src/pipeline.jl index 476b4256c..56d5827c3 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -416,4 +416,7 @@ function _add_the_series(plt, sp, plotattributes) push!(plt.series_list, series) push!(sp.series_list, series) _series_added(plt, series) + + #just to get it to work + update_clims(sp) end From a7295d554dfa32c36943ec4ddc109ace9a6774c5 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 13:22:25 -0400 Subject: [PATCH 06/17] Unnecessary to update here, I think --- src/colorbars.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index a0ce361c7..ece1e2360 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -20,8 +20,7 @@ get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = if series[:colorbar_entry] - clims = _update_clims(get(sp, :colorbar_limits, (Inf, -Inf))..., get_clims(series, op)...) - sp[:colorbar_limits] = clims + sp[:colorbar_limits] else get_clims(series, op) end From 45fc4eb5ab575e11f64ae1cf7cf304d9c9469fe2 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 13:26:54 -0400 Subject: [PATCH 07/17] return type --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index ece1e2360..c7d8f431e 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -5,7 +5,7 @@ process_clims(s::Union{Symbol,Nothing,Missing}) = ignorenan_extrema # don't specialize on ::Function otherwise python functions won't work process_clims(f) = f -function update_clims(sp::Subplot, op = process_clims(sp[:clims])) +function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = Inf, -Inf for series in series_list(sp) if series[:colorbar_entry] From 8542794a5e263740d125b7b8857f8a917e27ab30 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 15:02:51 -0400 Subject: [PATCH 08/17] Remove unnecessary default arg --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index c7d8f431e..600f72961 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -16,7 +16,7 @@ function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float6 sp[:colorbar_limits] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end -get_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} = sp[:colorbar_limits] +get_clims(sp::Subplot, op = nothing))::Tuple{Float64, Float64} = sp[:colorbar_limits] function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = if series[:colorbar_entry] From d576990f25c141d81992dccfe81cba25ba6ae549 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 19:31:30 -0400 Subject: [PATCH 09/17] Typo --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 600f72961..9ba78558f 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -16,7 +16,7 @@ function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float6 sp[:colorbar_limits] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end -get_clims(sp::Subplot, op = nothing))::Tuple{Float64, Float64} = sp[:colorbar_limits] +get_clims(sp::Subplot, op = nothing)::Tuple{Float64, Float64} = sp[:colorbar_limits] function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = if series[:colorbar_entry] From f7b4bef731897da4e37acff75710ca5569916926 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 20:20:10 -0400 Subject: [PATCH 10/17] Change to clims --- src/colorbars.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 9ba78558f..389405301 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -13,14 +13,14 @@ function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float6 end end - sp[:colorbar_limits] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) + sp[:clims] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end get_clims(sp::Subplot, op = nothing)::Tuple{Float64, Float64} = sp[:colorbar_limits] function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = if series[:colorbar_entry] - sp[:colorbar_limits] + sp[:clims] else get_clims(series, op) end From 761050509810284e4fdd334f86ff1629de97d9b8 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 20:21:16 -0400 Subject: [PATCH 11/17] missed one --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 389405301..e282dbd02 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -16,7 +16,7 @@ function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float6 sp[:clims] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end -get_clims(sp::Subplot, op = nothing)::Tuple{Float64, Float64} = sp[:colorbar_limits] +get_clims(sp::Subplot, op = nothing)::Tuple{Float64, Float64} = sp[:clims] function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = if series[:colorbar_entry] From fa5f29b8d5253d09a7e78c60cf9786e65ac4fecb Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 21:41:41 -0400 Subject: [PATCH 12/17] reconfigured to free up clims property --- src/colorbars.jl | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index e282dbd02..6855d8ba4 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -5,36 +5,36 @@ 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] + +function get_clims(sp::Subplot, series::Series)::Tuple{Float64, Float64} = + series[:colorbar_entry] ? + sp[:crange] : + series[:crange] + function update_clims(sp::Subplot, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} zmin, zmax = Inf, -Inf for series in series_list(sp) if series[:colorbar_entry] - zmin, zmax = _update_clims(zmin, zmax, get_clims(series, op)...) + zmin, zmax = _update_clims(zmin, zmax, update_clims(series, op)...) + else + update_clims(series, op) end end - - sp[:clims] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) -end - -get_clims(sp::Subplot, op = nothing)::Tuple{Float64, Float64} = sp[:clims] - -function get_clims(sp::Subplot, series::Series, op = process_clims(sp[:clims]))::Tuple{Float64, Float64} - zmin, zmax = if series[:colorbar_entry] - sp[:clims] - else - get_clims(series, op) - end - return zmin <= zmax ? (zmin, zmax) : (NaN, NaN) + return sp[:crange] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end """ - get_clims(::Series, op=Plots.ignorenan_extrema) + 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. +which must return the tuple `(zmin, zmax)`. The value is stored as a series property, which is +retrieved by `get_clims`. """ -function get_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float64} +function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float64} + println(" series") zmin, zmax = Inf, -Inf z_colored_series = (:contour, :contour3d, :heatmap, :histogram2d, :surface, :hexbin) for vals in ( @@ -49,7 +49,7 @@ function get_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float zmin, zmax = _update_clims(zmin, zmax, op(vals)...) end end - return zmin <= zmax ? (zmin, zmax) : (NaN, NaN) + return series[:crange] = zmin <= zmax ? (zmin, zmax) : (NaN, NaN) end _update_clims(zmin, zmax, emin, emax) = NaNMath.min(zmin, emin), NaNMath.max(zmax, emax) From 470a738cad4db8ba729fbee7e4ac01eca83b5d1a Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 21:42:53 -0400 Subject: [PATCH 13/17] fix --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 6855d8ba4..731e1b28a 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -9,7 +9,7 @@ process_clims(f) = f get_clims(sp::Subplot)::Tuple{Float64, Float64} = sp[:crange] get_clims(series::Series)::Tuple{Float64, Float64} = series[:crange] -function get_clims(sp::Subplot, series::Series)::Tuple{Float64, Float64} = +get_clims(sp::Subplot, series::Series)::Tuple{Float64, Float64} = series[:colorbar_entry] ? sp[:crange] : series[:crange] From a4d5c8bef00e73738bfa38f172d466027f0bc675 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 21:53:39 -0400 Subject: [PATCH 14/17] Remove debug println, add hook for updating clims after series added --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 731e1b28a..47fe8cc0b 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -34,7 +34,6 @@ which must return the tuple `(zmin, zmax)`. The value is stored as a series prop retrieved by `get_clims`. """ function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float64} - println(" series") zmin, zmax = Inf, -Inf z_colored_series = (:contour, :contour3d, :heatmap, :histogram2d, :surface, :hexbin) for vals in ( @@ -97,4 +96,5 @@ end function _update_subplot_colorbars(sp::Subplot) # Dynamic callback from the pipeline if needed + update_clims(sp) end From 27b25d9220f433c76e94eb51f71a02bbef0636d7 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 22:02:22 -0400 Subject: [PATCH 15/17] restore docstring --- src/colorbars.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 47fe8cc0b..5e9427295 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -30,8 +30,8 @@ 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 value is stored as a series property, which is -retrieved by `get_clims`. +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`. """ function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float64} zmin, zmax = Inf, -Inf From 5f1b5e9f01a4e64f309dbdac18f18a4fbfbedda1 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Thu, 23 Sep 2021 22:02:50 -0400 Subject: [PATCH 16/17] typo --- src/colorbars.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/colorbars.jl b/src/colorbars.jl index 5e9427295..3b4baf42a 100644 --- a/src/colorbars.jl +++ b/src/colorbars.jl @@ -30,7 +30,7 @@ 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 +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`. """ function update_clims(series::Series, op = ignorenan_extrema)::Tuple{Float64, Float64} From 2d8ceae577664a5bb47a4fcb07521994ee8eef70 Mon Sep 17 00:00:00 2001 From: Nicholas Bauer Date: Sat, 25 Sep 2021 13:10:54 -0400 Subject: [PATCH 17/17] Change to _update_subplot_colorbars --- src/pipeline.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pipeline.jl b/src/pipeline.jl index 56d5827c3..9de412b7d 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -416,7 +416,5 @@ function _add_the_series(plt, sp, plotattributes) push!(plt.series_list, series) push!(sp.series_list, series) _series_added(plt, series) - - #just to get it to work - update_clims(sp) + _update_subplot_colorbars(sp) end