I am wondering how to handle missing
values in a colorbar.
For my specific use case, I want to create a scatter plot where the data points are colored according to a third vector of values which may contain missing
. Before opening an issue, I am first checking if there is already a way to achieve this, that I have, for lack of better word, missed.
From what I can see, the only way I could do it right now is to loop over x
, y
and marker_z
simultaneously, and exclude values from all arrays for indices that satisfy ismissing(marker_z[i])
. This seems a bit silly, since up to the visualisation stage, missing
values were propagated through the processing without any issue.
There is one solution that I don’t think is curently possible. First, I relpace missing values with a number I know to be outside the valid cmap range, say:
cmap = replace(x -> ismissing(x) ? 0 : x, cmap_vector)
Then, I would need to combine two colorbars: at the bottom there is a single color for say (0, 10) which is a small range for which the colormap value is meaningless, and above that I have a gradient map as usual.
Alternatively, perhaps this requires a new keyword argument to cgrad
, something like missingcolor
? Then a small box could be drawn below the colorbar filled with missingcolor
and with an appropriate label… Maybe it’s too complicated.
I’m not sure what I think about this, and I wonder if anyone else has some ideas.
Leon