Merge pull request #1731 from mkborregaard/missings
rudimentary missings support
This commit is contained in:
commit
187a19bfd1
@ -21,11 +21,14 @@ convertToAnyVector(n::Integer, plotattributes::KW) = Any[zeros(0) for i in 1:n],
|
|||||||
|
|
||||||
# numeric vector
|
# numeric vector
|
||||||
convertToAnyVector(v::AVec{T}, plotattributes::KW) where {T<:Number} = Any[v], nothing
|
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
|
# string vector
|
||||||
convertToAnyVector(v::AVec{T}, plotattributes::KW) where {T<:AbstractString} = Any[v], nothing
|
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
|
||||||
|
|
||||||
function convertToAnyVector(v::AMat, plotattributes::KW)
|
function convertToAnyVector(v::AMat, plotattributes::KW)
|
||||||
|
v = handlemissings(v)
|
||||||
if all3D(plotattributes)
|
if all3D(plotattributes)
|
||||||
Any[Surface(v)]
|
Any[Surface(v)]
|
||||||
else
|
else
|
||||||
@ -33,6 +36,10 @@ function convertToAnyVector(v::AMat, plotattributes::KW)
|
|||||||
end, nothing
|
end, nothing
|
||||||
end
|
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 => "")
|
||||||
|
|
||||||
# function
|
# function
|
||||||
convertToAnyVector(f::Function, plotattributes::KW) = Any[f], nothing
|
convertToAnyVector(f::Function, plotattributes::KW) = Any[f], nothing
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user