Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink Palette/Contour/Heatmap interface #20

Open
btracey opened this issue Feb 17, 2015 · 0 comments
Open

Rethink Palette/Contour/Heatmap interface #20

btracey opened this issue Feb 17, 2015 · 0 comments

Comments

@btracey
Copy link
Member

btracey commented Feb 17, 2015

Palettes specify a list of colors. Strictly this is always a specific list, though may of the implemented palettes can create a long list of colors. These are being used at present to choose colors as part of Heatmaps and contours. In these cases, the z-axis values can be a real number, and a sort of interpolation function is being used to get the specific palette color. There are some special cases introduced, for example OverflowColor, which allow warning of specific colors.

In my mind, it's much better instead to have

// ColorFunc associates each float64 value with a color.Color
type ColorFunc func(float64) color.Color

A ColorFunc could use a palette as its underlying color choice. It could use a "threshholded palette", where it uses a palette for some intermediate range and uses warning colors outside of that range. There are many other possible uses, for example, returning a third warning color when the value is NaN, or having a grayscale image with a specific range of float64 returned as red to highlight their locations. It's much more powerful to have a function rather than just a palette with linear indexing, it's more composable because the special cases are located with the choice of color and not the choice of plotter, and (to me at least) it's more conceptually aligned with what's happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant