Separation of DotColorProvider and ColorProvider Interfaces (#34)
* fully functioning Viridis * pure functions
This commit is contained in:
parent
e53554fb04
commit
b3dc3fef3c
7 changed files with 18 additions and 13 deletions
|
|
@ -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]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue