Measurements.jl
Measurements.jl copied to clipboard
Plotting mixture of measurements and missing data
Hi,
I've got some results that are a mixture of measurements and missing data (type Vector{Union{Missing, Measurement{Float64}}}
). However, I get a MethodError
if I try to plot these:
plot([1±.1, 2±.3, missing, 4±.05])
MethodError: no method matching Float64(::Measurements.Measurement{Float64})
Closest candidates are:
(::Type{T})(::Real, !Matched::RoundingMode) where T<:AbstractFloat
@ Base rounding.jl:207
(::Type{T})(::T) where T<:Number
@ Core boot.jl:792
(::Type{T})(!Matched::AbstractChar) where T<:Union{AbstractChar, Number}
@ Base char.jl:50
...
convert(::Type{Float64}, ::Measurements.Measurement{Float64})@number.jl:7
setproperty!(::Plots.Extrema, ::Symbol, ::Measurements.Measurement{Float64})@Base.jl:38
[email protected]:425[inlined]
#[email protected]:444[inlined]
foreach(::Plots.var"#113#114"{Plots.Extrema}, ::Vector{Measurements.Measurement{Float64}})@abstractarray.jl:3073
expand_extrema!(::Plots.Axis, ::Vector{Measurements.Measurement{Float64}})@axes.jl:444
expand_extrema!(::Plots.Subplot{Plots.GRBackend}, ::RecipesPipeline.DefaultsDict)@axes.jl:479
_expand_subplot_extrema(::Plots.Subplot{Plots.GRBackend}, ::RecipesPipeline.DefaultsDict, ::Symbol)@pipeline.jl:433
add_series!(::Plots.Plot{Plots.GRBackend}, ::RecipesPipeline.DefaultsDict)@pipeline.jl:376
_process_seriesrecipe(::Any, ::Any)@series_recipe.jl:46
_process_seriesrecipes!(::Any, ::Any)@series_recipe.jl:27
recipe_pipeline!(::Any, ::Any, ::Any)@RecipesPipeline.jl:99
_plot!(::Plots.Plot, ::Any, ::Any)@plot.jl:223
#plot#[email protected]:102[inlined]
[email protected]:93[inlined]
Not sure if this is best raised here or with Plots!
Best,
Chris
I presume the fix should be done here because the recipes live in this repository, but I'm not sure what the solution should be, I'm not familiar with how Plots deal with missing data. Is it only a matter of adding methods for Vector{Union{Missing, Measurement}} and sprinkle skipmissing around?