def update_plot(self, Tcold, Thot): """ useless function """ pass self.axes.cla() self.conduction, self.convection = Math.PlottableAxesBoth(Tcold, Thot) self.axes.set_title(LocalVars.PlotTitle) self.axes.set_xlabel(LocalVars.PlotXLabel) self.axes.set_ylabel(LocalVars.PlotYLabel) self.cp = self.axes.contourf(*self.conduction, self.colorinterpolation, vmin=LocalVars.CMin, vmax=LocalVars.CMax, cmap=self.colourMap) self.sp = self.axes.streamplot(*self.convection) self.changed = True self.draw()
def compute_initial_figure(self): X,Y,T = Math.PlottableAxes(LocalVars.CMin, LocalVars.CMax) cp = self.axes.contourf(X, Y, T, self.colorinterpolation, vmin=LocalVars.CMin, vmax=LocalVars.CMax, cmap=self.colourMap) self.axes.set_title(LocalVars.PlotTitle) self.axes.set_xlabel(LocalVars.PlotXLabel) self.axes.set_ylabel(LocalVars.PlotYLabel) self.xlim = self.axes.set_xlim((np.min(X),np.max(X))) self.ylim = self.axes.set_xlim((np.min(Y),np.max(Y))) # Set Colorbar self.fig.colorbar(cp, label=LocalVars.PlotCMLabel, extend='max') self.conduction, self.convection = Math.PlottableAxesBoth(*self.data) self.cp = self.axes.contourf(*self.conduction,self.colorinterpolation, vmin=LocalVars.CMin, vmax=LocalVars.CMax, cmap=self.colourMap) self.sp = self.axes.streamplot(*self.convection) self.changed = True self.i = 0 self.on = False
def update_figure(self): if not self.on: return # Build a list of 4 random integers between 0 and 10 (both inclusive) """if self.changed: self.draw() self.changed = False self.fig.savefig("figure_%d.png"%self.i) self.i += 1 """ if self.dtt is None: l = random.randint(0, 5) r = random.randint(20, 30) else: try: l, r = self.dtt.readOne() print(l,r) except: return self.all_data.append((l,r)) self.axes.cla() self.conduction, self.convection = Math.PlottableAxesBoth(l,r,self.rho, self.nu, self.magnefying) self.axes.set_title(LocalVars.PlotTitle) self.axes.set_xlabel(LocalVars.PlotXLabel) self.axes.set_ylabel(LocalVars.PlotYLabel) self.cp = self.axes.contourf(*self.conduction, self.colorinterpolation, vmin=LocalVars.CMin, vmax=LocalVars.CMax, cmap=self.colourMap) self.sp = self.axes.streamplot(*self.convection) self.axes.set_xlim(self.xlim) self.axes.set_ylim(self.ylim) self.changed = True if self.savepath is not None: self.fig.savefig(self.savepath+"figure%d.png"%self.i) self.i += 1 self.draw()