Separation of DotColorProvider and ColorProvider Interfaces (#34)

* fully functioning Viridis

* pure functions
This commit is contained in:
Chris Redford 2017-04-17 16:21:02 -07:00 committed by Will Charczuk
parent e53554fb04
commit b3dc3fef3c
7 changed files with 18 additions and 13 deletions

View file

@ -262,8 +262,8 @@ var viridisColors = [256]drawing.Color{
}
// Viridis creates a color map provider.
func Viridis(xr, yr Range, x, y float64) drawing.Color {
normalized := (y - yr.GetMin()) / yr.GetDelta()
func Viridis(v, vmin, vmax float64) drawing.Color {
normalized := (v - vmin) / (vmax - vmin)
index := uint8(normalized * 255)
return viridisColors[index]
}