Commit 0b56b646 authored by Michele Maris's avatar Michele Maris
Browse files

u

parent 4344353b
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
import numpy as np
class rgb_interpolator :
   """a class to generate a 2 rgb colors interpolator """
   @property
   def color0(self) :
      """the 0 color"""
      return self._color0

   @property
   def color1(self) :
      """the 1 color"""
      return self._color1

   def __init__(self,rgb0,rgb1) :
      self._color0=np.array(rgb0,dtype=float)
      self._color1=np.array(rgb1,dtype=float)

   def __call__(self,x) :
      if x <0 or x>1 :
         raise Exception('x must be in [0,1]')
      return self._color0*(1-x)+self._color1*x


class ImshowXT :
   """ class to handle an improved version of plt.imshow """
   def __init__(self,matr,x_values,y_values,**kwargs) :