I’ve only just discovered series in GLMakie as a simple way of plotting rows of a matrix. This is something I do a lot (actually, I’d prefer to plot columns, but never mind) but it doesn’t seem to like plotting more series than there are colours in the scheme.
E.g., series(rand(7,100) is fine, but series(rand(8,100)) results in
ERROR: Not enough colors for number of categories. Categories: 8, colors: 7
Is there an easy way to get series to cycle through colors rather than give up if there are too many rows in the matrix?
This happens because we chose a colormap which looks good, but doesn’t have infinite colors for infinite categories, so at some point it must error that it doesn’t have enough colors.
Categorical colors are somewhat hard for large amounts of categories, since one still wants them to be maximally distinguishable, while looking nice!
You can pass color=colormap_with_enough_colors. Easiest way to achieve this would be color=rand(RGBf, 8), but that isn’t guaranteed to look good nor be maximally distinguishable.
If anyone has a good idea how to not error and more nicely scale up distinguishable colors that look good beyond 7 colors, please open an issue / pr
I initially experimented with Colormaps and Colorscales · Colors, but wasn’t too happy with the look of that. But maybe worth giving it another try.
Yes, because then you map multiple lines to the same color, which can be pretty dangerous if the user is unaware of this - for cycling with single line calls, this seems fine to me, but a single call to series mapping multiple lines to one color sounds to me like a setup for subtle bugs…
Thanks for your help - understood. I used to use Matlab a lot and that would plot the columns of a matrix by default iirc, which was quite convenient for the sorts of things I’m doing (dealing with data from a 64-channel sensor), but your reasoning is equally valid.