piebro / openstreetmap-statistics

Monthly updated interactive statistics about OpenStreetMap.
https://piebro.github.io/openstreetmap-statistics/
MIT License
34 stars 6 forks source link

stable colors for StreetComplete quests also would be nice #44

Closed matkoniecz closed 1 year ago

matkoniecz commented 1 year ago

28 for https://piebro.github.io/openstreetmap-statistics/#d06d and https://piebro.github.io/openstreetmap-statistics/#3ff2

westnordost commented 1 year ago

So, what is needed is a function that takes any string (quest name) and converts it to a color (or rather: hue). So, something like hue = hash(questName) %255 could theoretically do. However, there is a chance that some colors end up very very close to each other. I do not see how to avoid this without manually assigning each quest an own color.

In summary, I do think that the downsides outweight the potential advantage: It would be worse if two quests get exactly the same or very very similar colors than if the same quest has different colors in different statistics.

piebro commented 1 year ago

Well even right now, the colors do repeat. The plots use the default plotly colors, which are 13 distinct colors and then they repeat. I think repetition is fine and not really avoidable since 221 distinct colors for each quest would be a lot. There are some other color palettes I could use (e.g., from matplotlib), but there are also at max 20 distinct colors and I think It's nice if all plots have the same color palette.

So I think the repetition is not really a problem, but the lines with the same color should be as far apart as possible. If we have the same coloring in each plot, they are far apart in the first plot but could be next to each other in the next plot. This happens in editing software total amount in the second plot with SC and bulk_upload.py/posiki

In conclusion, maybe here it makes sense https://piebro.github.io/openstreetmap-statistics/#d06d because it's not very likely that colors are close to each other, but not for the graph with all quests. (One could solve the problem of avoiding the same colors to close to each other in multiple graphs with some kind of optimizing problem. There probably is one in scipy that's useable.)