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) # Set Colorbar self.fig.colorbar(cp, label="Temperature (Celsius)", extend='max') self.X,self.Y,self.T = Math.PlottableAxes(*self.data) self.cp = self.axes.contourf(self.X,self.Y,self.T,self.colorinterpolation, vmin=LocalVars.CMin, vmax=LocalVars.CMax, cmap=self.colourMap) self.changed = True self.i = 0
def update_figure(self): # 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.axes.cla() X, Y, T = Math.PlottableAxes(l,r) self.axes.set_title(LocalVars.PlotTitle) self.axes.set_xlabel(LocalVars.PlotXLabel) self.axes.set_ylabel(LocalVars.PlotYLabel) self.axes.contourf(X, Y, T, self.colorinterpolation, vmin=LocalVars.CMin, vmax=LocalVars.CMax, cmap=self.colourMap) self.draw()
def update_plot(self, Tcold, Thot): pass self.axes.cla() self.X,self.Y,self.T = Math.PlottableAxes(Tcold, Thot) self.axes.set_title(LocalVars.PlotTitle) self.axes.set_xlabel(LocalVars.PlotXLabel) self.axes.set_ylabel(LocalVars.PlotYLabel) self.axes.contourf(self.X, self.Y, self.T, self.colorinterpolation, vmin=LocalVars.CMin, vmax=LocalVars.CMax, cmap=self.colourMap) 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