Python matplotlib.pylab.draw() Examples
The following are 4
code examples of matplotlib.pylab.draw().
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: mpl.py From spotpy with MIT License | 6 votes |
def _make_widgets(self): """ Creates the sliders :return: """ if hasattr(self, 'sliders'): for s in self.sliders: s.ax.remove() sliders = [] step = max(0.005, min(0.05, 0.8/len(self.parameter_array))) for i, row in enumerate(self.parameter_array): rect = [0.75, 0.9 - step * i, 0.2, step - 0.005] s = Widget(rect, Slider, row['name'], row['minbound'], row['maxbound'], valinit=row['optguess'], on_changed=ValueChanger(row['name'], self.parameter_values)) sliders.append(s) plt.draw() return sliders
Example #2
Source File: mpl.py From spotpy with MIT License | 6 votes |
def run(self, _=None): """ Runs the model and plots the result """ self.ax.set_title('Calculating...') plt.draw() time.sleep(0.001) parset = create_set(self.setup, **self.parameter_values) sim = self.setup.simulation(parset) objf = as_scalar(self.setup.objectivefunction(sim, self.setup.evaluation())) label = ('{:0.4g}=M('.format(objf) + ', '.join('{f}={v:0.4g}'.format(f=f, v=v) for f, v in zip(parset.name, parset)) + ')') self.lines.extend(self.ax.plot(sim, '-', label=label)) self.ax.legend() self.ax.set_title(type(self.setup).__name__) plt.draw()
Example #3
Source File: usage_example.py From tensorflow-ffmpeg with MIT License | 6 votes |
def _show_video(video, fps=10): # Import matplotlib/pylab only if needed import matplotlib matplotlib.use('TkAgg') import matplotlib.pylab as pl pl.style.use('ggplot') pl.axis('off') if fps < 0: fps = 25 video /= 255. # Pylab works in [0, 1] range img = None pause_length = 1. / fps try: for f in range(video.shape[0]): im = video[f, :, :, :] if img is None: img = pl.imshow(im) else: img.set_data(im) pl.pause(pause_length) pl.draw() except: pass
Example #4
Source File: pylabtools.py From Computable with MIT License | 5 votes |
def mpl_runner(safe_execfile): """Factory to return a matplotlib-enabled runner for %run. Parameters ---------- safe_execfile : function This must be a function with the same interface as the :meth:`safe_execfile` method of IPython. Returns ------- A function suitable for use as the ``runner`` argument of the %run magic function. """ def mpl_execfile(fname,*where,**kw): """matplotlib-aware wrapper around safe_execfile. Its interface is identical to that of the :func:`execfile` builtin. This is ultimately a call to execfile(), but wrapped in safeties to properly handle interactive rendering.""" import matplotlib import matplotlib.pylab as pylab #print '*** Matplotlib runner ***' # dbg # turn off rendering until end of script is_interactive = matplotlib.rcParams['interactive'] matplotlib.interactive(False) safe_execfile(fname,*where,**kw) matplotlib.interactive(is_interactive) # make rendering call now, if the user tried to do it if pylab.draw_if_interactive.called: pylab.draw() pylab.draw_if_interactive.called = False return mpl_execfile