def _value_to_color(value, cmap):
    """Convert a value in the range [0,1] to an RGB tuple using a colormap."""
    cm = plt.get_cmap(cmap)
    rgba = cm(value)
    return [int(round(255*v)) for v in rgba[0:3]]