just passing the full range.

This commit is contained in:
Will Charczuk 2017-04-15 09:07:59 -07:00
parent 079c471daf
commit 03ac305951
4 changed files with 10 additions and 7 deletions

View file

@ -266,7 +266,10 @@ var viridisColors = [256]drawing.Color{
}
// Viridis creates a color map provider.
func Viridis(rx, ry, x, y float64) drawing.Color {
index := uint8((y / ry) * 256)
func Viridis(xr, yr Range, x, y float64) drawing.Color {
delta := yr.GetDelta()
normalized := y / delta
adjusted := normalized + yr.GetMin()
index := uint8(adjusted * 256)
return viridisColors[index]
}