code: def toColor(val, colormap):
      
      for i in range(0, len(colormap) - 1):
          if colormap[i + 1][0] > val:
              scale = (val - colormap[i][0]) / \
                  (colormap[i + 1][0] - colormap[i][0])
              r = colormap[i][1][0] + \
                  (colormap[i + 1][1][0] - colormap[i][1][0]) * scale
              g = colormap[i][1][1] + \
                  (colormap[i + 1][1][1] - colormap[i][1][1]) * scale
              b = colormap[i][1][2] + \
                  (colormap[i + 1][1][2] - colormap[i][1][2]) * scale
              return "#" + toHex(r) + toHex(g) + toHex(b)
      return "#" + toHex(colormap[-1][1][0]) + toHex(colormap[-1][1][1]) + toHex(colormap[-1][1][2])
docs: Converts the given value (0-1) into a color definition parseable by matplotlib