I starting using AlgebraOfGraphics and I really like it so far.
Now I’m using it in a Pluto notebook to plot two variables as a scatter colored by groups with CairoMakie as a backend. I also added some checkboxes to make the plot interactive so the user can choose which groups are plotted or not. But I would like to have a mapping between my group values and a color so the color of a group does not change based on which other group is plotted or not.
I know we can change the color palette using the palettes argument thanks to this question/answer, but what I want is choosing which color is associated to which group in my data.
I tried computing the color beforehand and pass it as an array to the color argument in the mapping and in the palette argument of draw, and I tried to pass a Dict mapping my group names to the color value as a palette. But none of these worked.
I know I could use another back-end to make the plots interactive (e.g. the WGLMakie), but I would prefer using CairoMakie because other actions are triggered on the group choice too.
For those familiar with ggplot I would simply like to use something similar to: