def compute_quads2(N=4): x = np.linspace(0, N-1, N) X, Y = np.meshgrid(x, x) Z = X**2+Y**2 Z = Z.reshape((8, 2)) item = make.pcolor(Z) # checks if X, Y are properly generated in make.pcolor return [item]
def __init__(self, xyz): super().__init__(xlabel='Time', ylabel='Frequency', xunit='s', yunit='Hz', yreverse=False, lock_aspect_ratio=False) (x,y,z) = xyz itm = make.pcolor(x,y,z) self.plot.add_item(itm) self.register_all_image_tools()
def pcolorshow(self, aX, aY, aData, title=None): """ Create 2D xyimage for guiqwt image dialog Returns -------- plot : ? Plot widget in guiqwt ImageDialog image : ? new image object """ from guiqwt.builder import make image = make.pcolor( aX, aY, aData, interpolation="nearest", title=title, ) plot = self.win.get_plot() plot.add_item(image) plot.do_autoscale() plot.replot() return plot, image
def compute_quads3(): pi = np.pi cos = np.cos sin = np.sin items = [] for i, t in enumerate(np.linspace(0, 2 * pi, 16)): X = np.array([[0.0, cos(t)], [-sin(t), cos(t) - sin(t)]]) Y = np.array([[0.0, sin(t)], [cos(t), sin(t) + cos(t)]]) Z = np.array([[1., 2.], [3., 4.]]) item = make.pcolor(X - 16 + 2 * i, Y - 3, Z) items.append(item) return items
def compute_quads3(): pi = np.pi cos = np.cos sin = np.sin items = [] for i, t in enumerate( np.linspace(0, 2*pi, 16) ): X = np.array( [[ 0.0, cos(t)], [-sin(t), cos(t)-sin(t)]] ) Y = np.array( [[ 0.0, sin(t)], [cos(t), sin(t)+cos(t)]] ) Z = np.array([[1., 2.], [3., 4.]]) item = make.pcolor(X-16+2*i, Y-3, Z) items.append(item) return items
def pcolor(*args): """ Create a pseudocolor plot of a 2-D array Example: import numpy as np r = np.linspace(1., 16, 100) th = np.linspace(0., np.pi, 100) R, TH = np.meshgrid(r, th) X = R*np.cos(TH) Y = R*np.sin(TH) Z = 4*TH+R pcolor(X, Y, Z) show() """ axe = gca() img = make.pcolor(*args) axe.add_image(img) axe.yreverse = len(args) == 1 _show_if_interactive() return [img]
def compute_quads(N=300): X, Y, Z = polar_demo(N) item = make.pcolor(X, Y, Z) return [item]