plotters
plotters copied to clipboard
Extend Palette mechanism and offer more choices of palettes
Extend Palette trait
I've been recently using plotters to do some scatters plots of point sequences. Its great, I love the gif backend. amazing crate.
As I wanted to colors my plots, I've been exploring the Palette trait.
I quickly wished for the following features:
- more choices of palette Following link has great examples of high quality palettes that could be used: https://bids.github.io/colormap/
- a way to index a palette color by float, in [0; 1] range
- a way to interpolate palette.
I'm not sure what would be the best way to implemented those features.. The Palette trait could be extended with functions like those
pub trait Palette {
...
fn linear_sample(x: f64) -> RBColor;
fn point_sample(x: f64) -> RBColor;
}
or perhaps a new struct could be implemented, InterpolatedPaletteColor, and its trait Color implementation would do the interpolation.
pub struct InterpolatedPaletteColor<P: Palette>(f64, PhantomData<P>);