From 0b56b6468327038c79dc51972df2551ecfbea5f1 Mon Sep 17 00:00:00 2001 From: "michele.maris" Date: Tue, 24 Jun 2025 11:51:09 +0200 Subject: [PATCH] u --- src/yapsut/graphics.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/yapsut/graphics.py b/src/yapsut/graphics.py index 133ba20..5cfebe1 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) : -- GitLab