diff --git a/src/yapsut/graphics.py b/src/yapsut/graphics.py index 133ba20970c421f44173a6d46449f72114b4d7a9..5cfebe1431cff3a38250be2453bbe47950534088 100644 --- a/src/yapsut/graphics.py +++ b/src/yapsut/graphics.py @@ -1,3 +1,26 @@ +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) :