For a given val
we are able to get the RGB tuple tup
via the following method:
import matplotlib as mpl
tup = mpl.cm.viridis(val)
here viridis
is the default matplotlib colormap.
How do I do the reverse? I.e. get val
from tup
?
For a given val
we are able to get the RGB tuple tup
via the following method:
import matplotlib as mpl
tup = mpl.cm.viridis(val)
here viridis
is the default matplotlib colormap.
How do I do the reverse? I.e. get val
from tup
?