Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotting mixture of measurements and missing data #149

Open
chriswaudby opened this issue Sep 5, 2023 · 1 comment
Open

Plotting mixture of measurements and missing data #149

chriswaudby opened this issue Sep 5, 2023 · 1 comment

Comments

@chriswaudby
Copy link

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

@giordano
Copy link
Member

giordano commented Sep 5, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants