scikit-tda / kepler-mapper

Kepler Mapper: A flexible Python implementation of the Mapper algorithm.
https://kepler-mapper.scikit-tda.org
MIT License
631 stars 183 forks source link

Flexible options for color palette. #112

Open sauln opened 6 years ago

sauln commented 6 years ago

Currently, the color palette is hardcoded in visuals.py: https://github.com/MLWave/kepler-mapper/blob/0dfa7f736bd4218e8996888785b9d2adc63d5344/kmapper/visuals.py#L8-L15

and again in kmapper.js

https://github.com/MLWave/kepler-mapper/blob/0dfa7f736bd4218e8996888785b9d2adc63d5344/kmapper/static/kmapper.js#L25-L32

I'd like to see this

Reducing the duplication should be straight forward. Allowing arbitrary palettes might be more difficult. Does the current code assume palettes of a certain length?

MLWave commented 6 years ago

Does the current code assume palettes of a certain length?

Yes. I think I could make the custom palette work and apply proper normalization. If we set a default with the current palette, then that would fix the duplication problem too (of course this logic would need to be moved from static, to grabbing the palette somewhere from the generated HTML).

sauln commented 6 years ago

Ideally, we could accept any matplotlib colormap (https://matplotlib.org/users/colormaps.html). There are a few coloring issues I'd like to take care of in the next month, I'll try to sink my teeth into them when I get a chance

sauln commented 6 years ago

Some of this is being handled by PR #113