Exemplo n.º 1
0
def _matplotlib_color(colormap: Colormap, data: float) -> str:
    (r, g, b, a) = colormap.__call__(data)
    r = round(255 * r)
    g = round(255 * g)
    b = round(255 * b)

    return _rgb_color((r, g, b))
Exemplo n.º 2
0
 def __call__(self, value, *args, **kwargs):
     # get the color
     result = Colormap.__call__(self, value, *args, **kwargs)
     # add meta values to it
     result = CmapColor(result)
     result.setMeta(value, self)
     # return the color
     return result
Exemplo n.º 3
0
 def __call__(self, value: float, *args, **kwargs):
     """ get the color associated with the given value from the colormap """
     # get the color
     result = Colormap.__call__(self, value, *args, **kwargs)
     # add meta values to it
     result = CmapColor(result)
     result.setMeta(value, self)
     # return the color
     return result
Exemplo n.º 4
0
 def __call__(self, X, alpha=1.0, bytes=False):
    if self.bad_set:
       if not isinstance(X, numpy.ma.masked_array):
          X = numpy.ma.asarray(X)
       X.mask = ma.make_mask(~numpy.isfinite(X))
    return Colormap.__call__(self, X, alpha, bytes)