def setx(x): if x is None: return import numpy as np try: arr = np.array(x) except Exception as e: errmsg = 'Matplotlib widgets need an array-like value' raise TypeError(errmsg) from e with Ax(self) as ax: if len(arr.shape) == 1: ax.plot(arr) elif len(arr.shape) == 2: ax.imshow(arr) else: raise ValueError('Value must be 1d or 2d, shape is %s instead' % str(arr.shape))
def replot(gui, value): with Ax(gui.plot) as ax: ax.set_title('y=sin(x)') t = np.linspace(0, 1+value/10, 500) ax.plot(t, np.sin(t), ".-")
def setPlot4(gui, oi, smap1, cmap='hot'): with Ax(gui.plot4) as ax: ax.clear() ax.set_title('Titolo') im = ax.imshow(smap1, origin='lower', cmap=cmap)
def setPlot3(gui, oi, cmap='viridis'): with Ax(gui.plot3) as ax: ax.clear() ax.set_title('Titolo') im = ax.imshow(oi.ott_view(), origin='lower', cmap=cmap)
def setPlot2(gui, oi, smap1, smask, cmap='viridis'): image = oi.pwrap(smap1, smask) with Ax(gui.plot2) as ax: ax.clear() ax.set_title('Titolo') im = ax.imshow(image, origin='lower', cmap=cmap)
def setPlot(gui, image, cmap='viridis'): with Ax(gui.plot) as ax: ax.clear() ax.set_title('Titolo') im = ax.imshow(image, origin='lower', cmap=cmap)