Skip to content

Commit

Permalink
Merge pull request #1731 from mkborregaard/missings
Browse files Browse the repository at this point in the history
rudimentary missings support
  • Loading branch information
mkborregaard authored Sep 7, 2018
2 parents 3197db9 + 91816e6 commit 187a19b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/series.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,25 @@ convertToAnyVector(n::Integer, plotattributes::KW) = Any[zeros(0) for i in 1:n],

# 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

function convertToAnyVector(v::AMat, plotattributes::KW)
v = handlemissings(v)
if all3D(plotattributes)
Any[Surface(v)]
else
Any[v[:,i] for i in 1:size(v,2)]
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 => "")

# function
convertToAnyVector(f::Function, plotattributes::KW) = Any[f], nothing

Expand Down

0 comments on commit 187a19b

Please sign in to comment.