Created
May 11, 2018 04:10
-
-
Save zxf8665905/962e33878f5a5e23205ea79b0e967396 to your computer and use it in GitHub Desktop.
get heatmap rgb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def heat_map_rgb(minimum, maximum, value): | |
minimum, maximum = float(minimum), float(maximum) | |
ratio = 2 * (value-minimum) / (maximum - minimum) | |
b = int(max(0, 255*(1 - ratio))) | |
r = int(max(0, 255*(ratio - 1))) | |
g = 255 - b - r | |
return (r, g, b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment