diff --git a/src/series.jl b/src/series.jl index 89d41152..b3aaedcd 100644 --- a/src/series.jl +++ b/src/series.jl @@ -19,13 +19,8 @@ convertToAnyVector(v::Nothing, plotattributes::KW) = Any[nothing], nothing # fixed number of blank series convertToAnyVector(n::Integer, plotattributes::KW) = Any[zeros(0) for i in 1:n], nothing -# numeric vector -convertToAnyVector(v::AVec{T}, plotattributes::KW) where {T<:Number} = Any[v], nothing -convertToAnyVector(v::AVec{Union{Missing, T}}, plotattributes::KW) where {T<:Number} = Any[replace(v, missing => NaN)], nothing - -# string vector -convertToAnyVector(v::AVec{T}, plotattributes::KW) where {T<:AbstractString} = Any[v], nothing -convertToAnyVector(v::AVec{Union{Missing, T}}, plotattributes::KW) where {T<:AbstractString} = Any[replace(v, missing => "")], nothing +# numeric/string vector +convertToAnyVector(v::AVec{T}, plotattributes::KW) where {T<:Union{Number,String,Missing}} = Any[handlemissings(v)], nothing function convertToAnyVector(v::AMat, plotattributes::KW) v = handlemissings(v) @@ -36,9 +31,9 @@ function convertToAnyVector(v::AMat, plotattributes::KW) end, nothing end -handlemissings(v::AMat) = v -handlemissings(v::AMat{T}) where T <: Number = replace(v, missing => NaN) -handlemissings(v::AMat{T}) where T <: String = replace(v, missing => "") +handlemissings(v) = v +handlemissings(v::AbstractArray{Union{T,Missing}}) where T <: Number = replace(v, missing => NaN) +handlemissings(v::AbstractArray{Union{T,Missing}}) where T <: String = replace(v, missing => "") # function convertToAnyVector(f::Function, plotattributes::KW) = Any[f], nothing diff --git a/test/runtests.jl b/test/runtests.jl index e2f7b9c5..d5f6864b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -54,7 +54,9 @@ end plots = [histogram([1, 0, 0, 0, 0, 0]), plot([missing]), plot([missing; 1:4]), - plot([fill(missing,10); 1:4])] + plot([fill(missing,10); 1:4]), + plot([1 1; 1 missing]), + plot(["a" "b"; missing "d"], [1 2; 3 4])] for plt in plots display(plt) end