Python matplotlib.pylab.ion() Examples
The following are 9
code examples of matplotlib.pylab.ion().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.pylab
, or try the search function
.
Example #1
Source File: testfuncs.py From Computable with MIT License | 6 votes |
def plotallfuncs(allfuncs=allfuncs): from matplotlib import pylab as pl pl.ioff() nnt = NNTester(npoints=1000) lpt = LinearTester(npoints=1000) for func in allfuncs: print(func.title) nnt.plot(func, interp=False, plotter='imshow') pl.savefig('%s-ref-img.png' % func.func_name) nnt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-nn-img.png' % func.func_name) lpt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-lin-img.png' % func.func_name) nnt.plot(func, interp=False, plotter='contour') pl.savefig('%s-ref-con.png' % func.func_name) nnt.plot(func, interp=True, plotter='contour') pl.savefig('%s-nn-con.png' % func.func_name) lpt.plot(func, interp=True, plotter='contour') pl.savefig('%s-lin-con.png' % func.func_name) pl.ion()
Example #2
Source File: testfuncs.py From matplotlib-4-abaqus with MIT License | 6 votes |
def plotallfuncs(allfuncs=allfuncs): from matplotlib import pylab as pl pl.ioff() nnt = NNTester(npoints=1000) lpt = LinearTester(npoints=1000) for func in allfuncs: print(func.title) nnt.plot(func, interp=False, plotter='imshow') pl.savefig('%s-ref-img.png' % func.func_name) nnt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-nn-img.png' % func.func_name) lpt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-lin-img.png' % func.func_name) nnt.plot(func, interp=False, plotter='contour') pl.savefig('%s-ref-con.png' % func.func_name) nnt.plot(func, interp=True, plotter='contour') pl.savefig('%s-nn-con.png' % func.func_name) lpt.plot(func, interp=True, plotter='contour') pl.savefig('%s-lin-con.png' % func.func_name) pl.ion()
Example #3
Source File: testfuncs.py From neural-network-animation with MIT License | 6 votes |
def plotallfuncs(allfuncs=allfuncs): from matplotlib import pylab as pl pl.ioff() nnt = NNTester(npoints=1000) lpt = LinearTester(npoints=1000) for func in allfuncs: print(func.title) nnt.plot(func, interp=False, plotter='imshow') pl.savefig('%s-ref-img.png' % func.__name__) nnt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-nn-img.png' % func.__name__) lpt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-lin-img.png' % func.__name__) nnt.plot(func, interp=False, plotter='contour') pl.savefig('%s-ref-con.png' % func.__name__) nnt.plot(func, interp=True, plotter='contour') pl.savefig('%s-nn-con.png' % func.__name__) lpt.plot(func, interp=True, plotter='contour') pl.savefig('%s-lin-con.png' % func.__name__) pl.ion()
Example #4
Source File: testfuncs.py From ImageFusion with MIT License | 6 votes |
def plotallfuncs(allfuncs=allfuncs): from matplotlib import pylab as pl pl.ioff() nnt = NNTester(npoints=1000) lpt = LinearTester(npoints=1000) for func in allfuncs: print(func.title) nnt.plot(func, interp=False, plotter='imshow') pl.savefig('%s-ref-img.png' % func.__name__) nnt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-nn-img.png' % func.__name__) lpt.plot(func, interp=True, plotter='imshow') pl.savefig('%s-lin-img.png' % func.__name__) nnt.plot(func, interp=False, plotter='contour') pl.savefig('%s-ref-con.png' % func.__name__) nnt.plot(func, interp=True, plotter='contour') pl.savefig('%s-nn-con.png' % func.__name__) lpt.plot(func, interp=True, plotter='contour') pl.savefig('%s-lin-con.png' % func.__name__) pl.ion()
Example #5
Source File: demo_ui.py From spriteworld with Apache License 2.0 | 6 votes |
def __init__(self): self.rewards = 10 * [np.nan] self.rewards_bounds = [-10, 10] self.last_success = None plt.ion() self._fig = plt.figure( figsize=(9, 12), num='Spriteworld', facecolor='white') gs = gridspec.GridSpec(2, 1, height_ratios=[3, 1]) self._ax_image = plt.subplot(gs[0]) self._ax_image.axis('off') self._ax_scalar = plt.subplot(gs[1]) self._ax_scalar.spines['right'].set_visible(False) self._ax_scalar.spines['top'].set_visible(False) self._ax_scalar.xaxis.set_ticks_position('bottom') self._ax_scalar.yaxis.set_ticks_position('left') self._setup_callbacks()
Example #6
Source File: testfuncs.py From Computable with MIT License | 4 votes |
def plot(self, func, interp=True, plotter='imshow'): import matplotlib as mpl from matplotlib import pylab as pl if interp: lpi = self.interpolator(func) z = lpi[self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] else: y, x = np.mgrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] z = func(x, y) z = np.where(np.isinf(z), 0.0, z) extent = (self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) pl.ioff() pl.clf() pl.hot() # Some like it hot if plotter == 'imshow': pl.imshow(np.nan_to_num(z), interpolation='nearest', extent=extent, origin='lower') elif plotter == 'contour': Y, X = np.ogrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] pl.contour(np.ravel(X), np.ravel(Y), z, 20) x = self.x y = self.y lc = mpl.collections.LineCollection( np.array([((x[i], y[i]), (x[j], y[j])) for i, j in self.tri.edge_db]), colors=[(0, 0, 0, 0.2)]) ax = pl.gca() ax.add_collection(lc) if interp: title = '%s Interpolant' % self.name else: title = 'Reference' if hasattr(func, 'title'): pl.title('%s: %s' % (func.title, title)) else: pl.title(title) pl.show() pl.ion()
Example #7
Source File: testfuncs.py From matplotlib-4-abaqus with MIT License | 4 votes |
def plot(self, func, interp=True, plotter='imshow'): import matplotlib as mpl from matplotlib import pylab as pl if interp: lpi = self.interpolator(func) z = lpi[self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] else: y, x = np.mgrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] z = func(x, y) z = np.where(np.isinf(z), 0.0, z) extent = (self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) pl.ioff() pl.clf() pl.hot() # Some like it hot if plotter == 'imshow': pl.imshow(np.nan_to_num(z), interpolation='nearest', extent=extent, origin='lower') elif plotter == 'contour': Y, X = np.ogrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] pl.contour(np.ravel(X), np.ravel(Y), z, 20) x = self.x y = self.y lc = mpl.collections.LineCollection( np.array([((x[i], y[i]), (x[j], y[j])) for i, j in self.tri.edge_db]), colors=[(0, 0, 0, 0.2)]) ax = pl.gca() ax.add_collection(lc) if interp: title = '%s Interpolant' % self.name else: title = 'Reference' if hasattr(func, 'title'): pl.title('%s: %s' % (func.title, title)) else: pl.title(title) pl.show() pl.ion()
Example #8
Source File: testfuncs.py From neural-network-animation with MIT License | 4 votes |
def plot(self, func, interp=True, plotter='imshow'): import matplotlib as mpl from matplotlib import pylab as pl if interp: lpi = self.interpolator(func) z = lpi[self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] else: y, x = np.mgrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] z = func(x, y) z = np.where(np.isinf(z), 0.0, z) extent = (self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) pl.ioff() pl.clf() pl.hot() # Some like it hot if plotter == 'imshow': pl.imshow(np.nan_to_num(z), interpolation='nearest', extent=extent, origin='lower') elif plotter == 'contour': Y, X = np.ogrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] pl.contour(np.ravel(X), np.ravel(Y), z, 20) x = self.x y = self.y lc = mpl.collections.LineCollection( np.array([((x[i], y[i]), (x[j], y[j])) for i, j in self.tri.edge_db]), colors=[(0, 0, 0, 0.2)]) ax = pl.gca() ax.add_collection(lc) if interp: title = '%s Interpolant' % self.name else: title = 'Reference' if hasattr(func, 'title'): pl.title('%s: %s' % (func.title, title)) else: pl.title(title) pl.show() pl.ion()
Example #9
Source File: testfuncs.py From ImageFusion with MIT License | 4 votes |
def plot(self, func, interp=True, plotter='imshow'): import matplotlib as mpl from matplotlib import pylab as pl if interp: lpi = self.interpolator(func) z = lpi[self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] else: y, x = np.mgrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] z = func(x, y) z = np.where(np.isinf(z), 0.0, z) extent = (self.xrange[0], self.xrange[1], self.yrange[0], self.yrange[1]) pl.ioff() pl.clf() pl.hot() # Some like it hot if plotter == 'imshow': pl.imshow(np.nan_to_num(z), interpolation='nearest', extent=extent, origin='lower') elif plotter == 'contour': Y, X = np.ogrid[ self.yrange[0]:self.yrange[1]:complex(0, self.nrange), self.xrange[0]:self.xrange[1]:complex(0, self.nrange)] pl.contour(np.ravel(X), np.ravel(Y), z, 20) x = self.x y = self.y lc = mpl.collections.LineCollection( np.array([((x[i], y[i]), (x[j], y[j])) for i, j in self.tri.edge_db]), colors=[(0, 0, 0, 0.2)]) ax = pl.gca() ax.add_collection(lc) if interp: title = '%s Interpolant' % self.name else: title = 'Reference' if hasattr(func, 'title'): pl.title('%s: %s' % (func.title, title)) else: pl.title(title) pl.show() pl.ion()