From 995c7d349e4ef0ad605f61f6d7c93e49b69a512e Mon Sep 17 00:00:00 2001 From: Miles Lucas Date: Wed, 27 May 2020 11:55:49 -1000 Subject: [PATCH 1/3] fix type restriction in process_clims --- src/utils.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.jl b/src/utils.jl index eaeeb3b1..895d1ce3 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -420,7 +420,7 @@ ylims(sp_idx::Int = 1) = ylims(current(), sp_idx) zlims(sp_idx::Int = 1) = zlims(current(), sp_idx) # These functions return an operator for use in `get_clims(::Seres, op)` -process_clims(lims::NTuple{2,<:Number}) = (zlims -> ifelse.(isfinite.(lims), lims, zlims)) ∘ ignorenan_extrema +process_clims(lims::Tuple{<:Number,<:Number}) = (zlims -> ifelse.(isfinite.(lims), lims, zlims)) ∘ ignorenan_extrema process_clims(s::Union{Symbol,Nothing,Missing}) = ignorenan_extrema # don't specialize on ::Function otherwise python functions won't work process_clims(f) = f From ee1f9484485f673cb9c2971239859eb4477743f7 Mon Sep 17 00:00:00 2001 From: Miles Lucas Date: Wed, 27 May 2020 12:00:53 -1000 Subject: [PATCH 2/3] add process_clims tests --- test/runtests.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 696e147e..99c13cad 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -179,4 +179,9 @@ end @test isequal(collect(zip(Plots.unzip(z)...)), z) @test isequal(collect(zip(Plots.unzip(GeometryTypes.Point.(z))...)), z) end + op1 = process_clims((1.0, 2.0)) + op2 = process_clims((1, 2.0)) + data = randn(100, 100) + @test op1(data) == op2(data) + @test process_clims(nothing) == process_clims(missing) == process_clims(:auto) end From de81220c0118377bbbd37d3c91781d1397a0acc9 Mon Sep 17 00:00:00 2001 From: Miles Lucas Date: Wed, 27 May 2020 12:16:20 -1000 Subject: [PATCH 3/3] fix namespace --- test/runtests.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 99c13cad..68f50988 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -179,9 +179,9 @@ end @test isequal(collect(zip(Plots.unzip(z)...)), z) @test isequal(collect(zip(Plots.unzip(GeometryTypes.Point.(z))...)), z) end - op1 = process_clims((1.0, 2.0)) - op2 = process_clims((1, 2.0)) + op1 = Plots.process_clims((1.0, 2.0)) + op2 = Plots.process_clims((1, 2.0)) data = randn(100, 100) @test op1(data) == op2(data) - @test process_clims(nothing) == process_clims(missing) == process_clims(:auto) + @test Plots.process_clims(nothing) == Plots.process_clims(missing) == Plots.process_clims(:auto) end