From 330a7c61c9b2985e49ee097511d52b89fd517e4c Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 6 Apr 2020 17:16:32 +0200 Subject: [PATCH 1/3] allow type recipes for `Number`s in arrays and surfaces --- src/type_recipe.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/type_recipe.jl b/src/type_recipe.jl index 527fbae..df0f9e9 100644 --- a/src/type_recipe.jl +++ b/src/type_recipe.jl @@ -46,7 +46,7 @@ function _apply_type_recipe(plotattributes, v::AbstractArray, letter) end # special handling for Surface... need to properly unwrap and re-wrap -_apply_type_recipe(plotattributes, v::Surface{<:AMat{<:DataPoint}}) = v +_apply_type_recipe(plotattributes, v::Surface{<:AMat{<:Union{AbstractFloat, Integer, Missing}}}) = v function _apply_type_recipe(plotattributes, v::Surface) ret = _apply_type_recipe(plotattributes, v.surf) if typeof(ret) <: Formatted @@ -57,7 +57,7 @@ function _apply_type_recipe(plotattributes, v::Surface) end # don't do anything for datapoints or nothing -_apply_type_recipe(plotattributes, v::AbstractArray{<:DataPoint}, letter) = v +_apply_type_recipe(plotattributes, v::AbstractArray{<:Union{AbstractFloat, Integer, Missing}}, letter) = v _apply_type_recipe(plotattributes, v::Nothing, letter) = v # axis args before type recipes should still be mapped to all axes From deba630c30f3517fcc63619f605c79f0f846a012 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 6 Apr 2020 17:27:07 +0200 Subject: [PATCH 2/3] skip maybestrings --- src/type_recipe.jl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/type_recipe.jl b/src/type_recipe.jl index df0f9e9..bbb7e0f 100644 --- a/src/type_recipe.jl +++ b/src/type_recipe.jl @@ -46,7 +46,11 @@ function _apply_type_recipe(plotattributes, v::AbstractArray, letter) end # special handling for Surface... need to properly unwrap and re-wrap -_apply_type_recipe(plotattributes, v::Surface{<:AMat{<:Union{AbstractFloat, Integer, Missing}}}) = v +_apply_type_recipe(plotattributes, v::Surface{<:AMat{<:MaybeString}}) = v +_apply_type_recipe( + plotattributes, + v::Surface{<:AMat{<:Union{AbstractFloat, Integer, Missing}}}, +) = v function _apply_type_recipe(plotattributes, v::Surface) ret = _apply_type_recipe(plotattributes, v.surf) if typeof(ret) <: Formatted @@ -57,7 +61,12 @@ function _apply_type_recipe(plotattributes, v::Surface) end # don't do anything for datapoints or nothing -_apply_type_recipe(plotattributes, v::AbstractArray{<:Union{AbstractFloat, Integer, Missing}}, letter) = v +_apply_type_recipe(plotattributes, v::AbstractArray{<:MaybeString}, letter) = v +_apply_type_recipe( + plotattributes, + v::AbstractArray{<:Union{AbstractFloat, Integer, Missing}}, + letter, +) = v _apply_type_recipe(plotattributes, v::Nothing, letter) = v # axis args before type recipes should still be mapped to all axes From 480c031444eb2fa143be0248f523fe046824b805 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 6 Apr 2020 17:38:58 +0200 Subject: [PATCH 3/3] fix ambiguity --- src/type_recipe.jl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/type_recipe.jl b/src/type_recipe.jl index bbb7e0f..e3903e2 100644 --- a/src/type_recipe.jl +++ b/src/type_recipe.jl @@ -46,10 +46,9 @@ function _apply_type_recipe(plotattributes, v::AbstractArray, letter) end # special handling for Surface... need to properly unwrap and re-wrap -_apply_type_recipe(plotattributes, v::Surface{<:AMat{<:MaybeString}}) = v _apply_type_recipe( plotattributes, - v::Surface{<:AMat{<:Union{AbstractFloat, Integer, Missing}}}, + v::Surface{<:AMat{<:Union{AbstractFloat, Integer, AbstractString, Missing}}}, ) = v function _apply_type_recipe(plotattributes, v::Surface) ret = _apply_type_recipe(plotattributes, v.surf) @@ -61,10 +60,9 @@ function _apply_type_recipe(plotattributes, v::Surface) end # don't do anything for datapoints or nothing -_apply_type_recipe(plotattributes, v::AbstractArray{<:MaybeString}, letter) = v _apply_type_recipe( plotattributes, - v::AbstractArray{<:Union{AbstractFloat, Integer, Missing}}, + v::AbstractArray{<:Union{AbstractFloat, Integer, AbstractString, Missing}}, letter, ) = v _apply_type_recipe(plotattributes, v::Nothing, letter) = v