Cycling categorical color scale for unlimited unique values in Makie?

I am looking for a solution for a color map in Makie, for groups of points that need to be colored by their integer values (e.g. group number). There may be hundreds of unique values, so one can not see any visual difference between adjacent values when stretching a color map from its minimum to its maximum.

For each unique value, there should be a new color with sufficient visual difference, like is achieved with cgrad(:Set1_6, 25; categorical=true). The number of unique values varies, so it is best that it automatically recycles the color map as many times as needed.

You will not solve this by generating hundreds of distinct categorical colors. While you might be able to discriminate between pairs of colors with such small distances when they are next to each other, you’ll not be able to see which color is which if there are many small points in no particular order and you have to map this back to a legend.

You can try Colors.distinguishable_colors with high N but I think you have to rethink the approach anyway Colormaps and Colorscales · Colors

Thanks for directing me to Colors.distinguishable_colors, Jules. Sounds good in itself, although in my Makie dashboard am changing the color map using an observable that contains the colorscale Symbol e.g. :turbo, so I need to find a way of producing my own Symbol color map from Colors.distinguishable_colors and the number of unique values, if that is possible.

A colormap can also just be a list of colors, make an Observable{Any} if you can’t update because you’re constrained to Symbol

This indeed works for me, with the Observable{Any}( ). I set it, for example to 50 colors. This results in unique colors whenever I use up to that amount of unique integer values. For float values and greater numbers of unique integers, it interpolates between the colors, which is totally fine, as I would not try to distinguish values until I zoom in to a limited selection of data.