def 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
More Related Contents:
- OpenCV giving wrong color to colored images on loading
- Converting an RGB color tuple to a hexidecimal string
- Converting Hex to RGB value in Python
- HSV to RGB Color Conversion
- Generate a heatmap in MatPlotLib using a scatter data set
- How to get different colored lines for different plots in a single figure?
- OpenCV: Choosing HSV thresholds for color filtering
- Plotly: How to define colors in a figure using Plotly Graph Objects and Plotly Express?
- Heatmap in matplotlib with pcolor?
- Making heatmap from pandas DataFrame
- Shifted colorbar matplotlib
- Is it possible to change sprite colours in Pygame?
- How to set the default color cycle for all subplots with matplotlib?
- How to make a tkinter Label background transparent?
- Convert RGB color to English color name, like ‘green’ with Python
- How to implement linear interpolation?
- How to make a tkinter canvas rectangle transparent?
- Plot curve with blending line colors with matplotlib/pyplot
- How to change the text color of font in legend?
- PIL rotate image colors (BGR -> RGB)
- Generate a heatmap using a scatter data set
- Named colors in matplotlib
- How can I convert RGB to CMYK and vice versa in python?
- python imshow, set certain value to defined color
- Python package to plot two heatmaps in one (split each square into two triangles)
- Elegantly changing the color of a plot frame in matplotlib
- 2D grid data visualization in Python
- How to understand Seaborn’s heatmap annotation format
- How to change the color of the axis, ticks and labels
- How to change the foreground or background colour of a selected cell in tkinter treeview?