How does one handle missing
in plots?
I am on [13f3f980] CairoMakie v0.4.5
Reproducer below. I haven’t grouped by id
below, but besides that point, how do we plot dv2
. The only way I can see doing that now is to create a non-missing vector of dv2 and then chop the time vector to be of equal length for the second scatter that is commented out.
dd = DataFrame(id = [1,1,1,1,1,2,2,2,2,2],
time = [10,20, 30, 40, 50, 10,20, 30, 40, 50],
dv = [5.0, 4.0, 3.0, 2.0, 1.0,10.0, 9.0, 8.0, 7.0, 6.0],
dv2 = [5.0, 4.0, 3.0, 2.0, missing,10.0, 9.0, 8.0, 7.0, missing])
#
fig = Figure(resolution = (1000, 700))
ax1 = fig[1, 1] = Axis(fig,
title = "",
xlabel="Time (min)",
ylabel="Concentration (μg/L)")
scatter!(ax1,
dd[!,:time], dd[!,:dv])
# scatter!(ax1,
# dd[!,:time], dd[!,:dv2])
fig
[Update]
When I filter out the missing
in dv2
, and plot, the resulting Vector{Union{Missing, Float64}}
generates a plot that does not make sense (or obviously I am doing something wrong)
dd2 = filter(x-> !ismissing.(x.dv2), dd)
fig2 = Figure(resolution = (1000, 700))
ax2 = fig2[1, 1] = Axis(fig2,
title = "",
xlabel="Time (min)",
ylabel="Concentration (μg/L)")
# scatter!(ax2,
# dd2[!,:time], dd2[!,:dv])
scatter!(ax2,
dd2[!,:time], dd2[!,:dv2])
fig2
Why are the concentrations increasing here? they should decrease with time based on the dataset?