def make_plot(ratings_list, plot_dates, plot_tickers, plot_colors): # Prepare the data x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] # make the graph graph = Graph(ylabel='Ratings', x_ticks_major=1, y_ticks_minor=1, y_ticks_major=1, y_grid_label=True, x_grid_label=False, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=10, ymin=0, ymax=10) if (len(plot_tickers) > 0): i = 0 while (i < len(plot_tickers)): plot = MeshLinePlot(color=plot_colors[i]) plot.points = [(i, j) for i, j in zip(x, ratings_list[i])] graph.add_plot(plot) i += 1 return graph
def make_plot(plot_price, plot_dates, tickers_on_plot, plot_colors, xlabel='Bitcoin'): x = list(range(1, (len(plot_price) + 1))) y = plot_price y_axis_ticks = (max(y) - min(y)) / 5 plot = None graph = Graph(xlabel=xlabel, x_ticks_major=1, y_ticks_major=y_axis_ticks, y_grid_label=True, x_grid_label=True, padding=10, x_grid=False, y_grid=False, xmin=min(x), xmax=max(x), ymin=min(y), ymax=max(y)) for i in range(0, len(tickers_on_plot)): plot = MeshLinePlot(color=plot_colors[i]) plot.points = [(i, j) for i, j in zip(x, (y))] graph.add_plot(plot) return graph
def __init__(self, **kwargs): # Configuracion de Elementos relacionados con la comunicación Serie self.sensitivity = 2048 # conversion digital a G self.gravedad1 = 0 #constante para restar self.gravedad2 = 0 #constante para restar self.sampleRate = 1000 # SampleRate de Arduino # Variables lógicas usadas self.status = 0 self.cuentaFFT = 0 self.conectado = False self.graficosAmplitudDinamica = np.zeros(100) self.textosGraficosAmplitudDinamica = [] # Armado de app Widget con vinculo con archivo de estilo cistas.kv # Acomodar self.t_max = 5 # Tiempo en segundos que se muestran self.muestras_plot = self.t_max * self.sampleRate self.medicioncompleta1 = [] self.medicioncompleta2 = [] graph_ac1 = ObjectProperty(None) graph_ac2 = ObjectProperty(None) boton_on_libre = ObjectProperty(None) resetear = ObjectProperty(None) exportar = ObjectProperty(None) corregir = ObjectProperty(None) boton_conectar = ObjectProperty(None) texto_usuario = ObjectProperty(None) super().__init__(**kwargs) # Graficos self.plot_ac1 = MeshLinePlot(color=[0.8, 0.6, 0.9, 1]) self.plot_ac2 = MeshLinePlot(color=[0.4, 0.6, 0.9, 1])
def updatePoints(self, *args): #Pull data from LIFO queue from imu instance instant_imu = self.imu_instance.dq.get() instant_imu = instant_imu[1:5] #try with 4 or 5... odd behabior so debug opp # epoch time since beg 2021 self.c_time = instant_imu[0] - 1609477200 h_vec = [self.height, 0, 0] rr = R.from_quat(instant_imu) s = rr.apply(h_vec) self.cop.append([s[0], -1*s[1]]) if len(self.cop) > 50: self.cop = self.cop[-50:] plot_cop = MeshLinePlot(color=[0, 1, 0, 1]) plot_cop.points = self.cop self.root.ids.graph01.remove_plot(plot_cop) self.root.ids.graph01._clear_buffer(plot_cop) self.root.ids.graph01.add_plot(plot_cop)
def create_graph(self): colors = itertools.cycle([ rgb('7dac9f'), rgb('dc7062'), rgb('66a8d4'), rgb('e5b060') ]) graph_theme = { 'label_options': { 'color': (0, 0, 0, 1), 'bold': False}, 'background_color': (.9, .9, .9, 1), 'tick_color': rgb('808080'), 'border_color': rgb('808080') } graph = Graph(xlabel='', ylabel='Glicemia', font_size=14, x_ticks_minor=0, x_ticks_major=25, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=-0, xmax=100, ymin=-1, ymax=1, **graph_theme) #plot = MeshLinePlot(color=[1, 0, 0, 1]) plot = MeshLinePlot(color=next(colors)) plot.points = [(x, sin(x/10.)) for x in range(0, 101)] graph.add_plot(plot) return graph
def __init__(self, information=None): super(Logic, self).__init__() if information is None: information = dict() self.information = information self.mi = dict() self.nmi = dict() self.tmi = dict() self.twomi = dict() self.graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=.25, x_ticks_major=1, y_ticks_minor=1, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=-1, xmax=24, ymin=-1, ymax=1) self.red_plot = MeshLinePlot(color=[1, 0, 0, 1]) self.gre_plot = MeshLinePlot(color=[0, 1, 0, 1]) self.blu_plot = MeshLinePlot(color=[0, 0, 1, 1]) self.yel_plot = MeshLinePlot(color=[1, 1, 0, 1]) self.add_widget(widget=self.graph)
def compute_contours(self): graph = self.graph if graph is None or not self.x2_variable: return for plot in self._contour_plots: self.graph.remove_plot(plot) plots = self._contour_plots = [] data = np.clip(self._yvals, self.y_start, self.y_end) xscale = (self.end - self.start) / self.num_points x2scale = (self.x2_end - self.x2_start) / self.num_points color = next(self.colors) for val in np.linspace(self.y_start, self.y_end, self.num_contours): contours = measure.find_contours(data, val) for contour in contours: contour[:, 0] *= xscale contour[:, 0] += self.start contour[:, 1] *= x2scale contour[:, 1] += self.x2_start plot = MeshLinePlot(color=color) plots.append(plot) graph.add_plot(plot) plot.points = contour
def build(self): graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5, x_ticks_major=25, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=-0, xmax=100, ymin=-1, ymax=1) plot = MeshLinePlot(color=[1, 0, 0, 1]) plot.points = [(x, sin(x / 10.)) for x in range(0, 101)] graph.add_plot(plot) return graph
def __init__(self, **kwargs): super().__init__(**kwargs) print([type(widget) for widget in self.walk(loopback=True)]) plot = MeshLinePlot(color=[1, 0, 0, 1]) plot.points = [(x, sin(x / 10.)) for x in range(0, 101)] # Appel du widget avec l'id graph self.ids.graph.add_plot(plot)
def updatePoints(self, *args): instant_imu = self.imu_instance.dq.get() self.c_time = instant_imu[0] - 1609477200 #epoch time since beg 2021 if len(self.psi) > 1000: self.psi.append([self.c_time, instant_imu[1]]) self.phi.append([self.c_time, instant_imu[2]]) self.theta.append([self.c_time, instant_imu[3]]) self.psi = self.psi[-1:-7 * self.sensor_refresh] self.phi = self.phi[-1:-7 * self.sensor_refresh] self.theta = self.theta[-1:-7 * self.sensor_refresh] else: self.psi.append([self.c_time, instant_imu[1]]) self.phi.append([self.c_time, instant_imu[2]]) self.theta.append([self.c_time, instant_imu[3]]) plot_psi = MeshLinePlot(color=[1, 0, 0, 1]) plot_phi = MeshLinePlot(color=[0, 1, 0, 1]) plot_theta = MeshLinePlot(color=[0, 0, 1, 1]) plot_psi.points = self.psi plot_phi.points = self.phi plot_theta.points = self.theta self.root.ids.graph01.add_plot(plot_psi) self.root.ids.graph01.add_plot(plot_phi) self.root.ids.graph01.add_plot(plot_theta) self.root.ids.testYawOut.text = f'{instant_imu[1]}-> yaw'
def update_graph(self): self.graph.ymax = 10 # plot = MeshLinePlot(color=[1, 1, 0, 1]) # plot.points = [(x, sin(x / 10.)) for x in range(0, 101)] # # plot1 = MeshLinePlot(color=[1, 0, 0, 1]) # plot1.points = [(x, sin(x / 5.)) for x in range(0, 101)] plot2 = MeshLinePlot(color=[0, 0, 0, 1]) plot2.points = [(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8)] self.graph.add_plot(plot2)
def rainGraph(self): rainY = [] for i in range(len(self.fileData) - 19, len(self.fileData)): rainY.append(str(math.floor((float(self.fileData[i][8]))))) plot = None graph = Graph(size_hint = (0.5,0.8), pos_hint = {'x': .24, 'y': 0}, ylabel='Rain Events', xlabel='Time', x_ticks_major=1, y_ticks_minor=1, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=20, ymin=0, ymax=50, background_color = [1,1,1,.2]) plot = MeshLinePlot(color=[.5, 0, .5, 1]) plot.points = [(int(i), int(rainY[i])) for i in range(0, 19)] graph.add_plot(plot) return graph
def __init__(self, **kwargs): super(GraphPlot, self).__init__(**kwargs) self.y_range = 10 self.x_range = 10 self.range_multiplier = [2, 2.5, 2] self.graph = Graph(xlabel="x", ylabel="y", x_ticks_major=self.x_range / 2, y_ticks_major=self.y_range / 2, y_grid_label=True, x_grid_label=True, x_grid=True, y_grid=True, xmin=-self.x_range, xmax=self.x_range, ymin=-self.y_range, ymax=self.y_range, draw_border=False) # graph.size = (1200, 400) # self.graph.pos = self.center self.plot = MeshLinePlot(color=[1, 1, 1, 1]) x = -self.x_range self.plot.points = [] while x < self.x_range: try: self.plot.points.append((x, sin(x))) except ZeroDivisionError: pass x += self.x_range / 100 self.add_widget(self.graph) self.graph.add_plot(self.plot)
def __init__(self, **kwargs): """self.graph ne peut pas être initié ici. Il doit être dans une autre méthode et appelé plus tard. """ super().__init__(**kwargs) self.sensor_id = None self.unit_x = "" self.unit_y = "" self.graph = None self.histo = [] self.histo_data = None self.y_major = 0 self.titre = "Capteur" self.reset = None self.xlabel = "" self.duration = None # Initialisation de la courbe avec sa couleur self.curve_plot = MeshLinePlot(color=[0, 0, 0, 1]) self.curve_plot.points = [(0, 0)]*101 # horizontal_line self.line_plot = LinePlot(line_width=2, color=[1, 0, 0.5, 1]) # Appel tous les 2 secondes Clock.schedule_interval(self.update, 2)
def update(self): self.remove_widget(self.graph) self.graph = Graph(xlabel="x", ylabel="y", x_ticks_major=self.x_range / 2, y_ticks_major=self.y_range / 2, y_grid_label=True, x_grid_label=True, x_grid=True, y_grid=True, xmin=-self.x_range, xmax=self.x_range, ymin=-self.y_range, ymax=self.y_range, draw_border=False) self.plot = MeshLinePlot(color=[1, 1, 1, 1]) x = -self.x_range self.plot.points = [] while x < self.x_range: try: self.plot.points.append((x, sin(x))) except ZeroDivisionError: pass x += self.x_range / 100 self.add_widget(self.graph) self.graph.add_plot(self.plot)
def humidGraph(self): humidY = [] for i in range(len(self.fileData) - 19, len(self.fileData)): humidY.append(str(math.floor((float(self.fileData[i][4]))))) humidityPlot = None humidityGraph = Graph(size_hint = (0.5,0.8), pos_hint = {'x': .24, 'y': 0}, ylabel='% Humidity', xlabel='Time', x_ticks_major=1, y_ticks_minor=1, y_ticks_major=1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=20, ymin=0, ymax=100, background_color = [1,1,1,.2]) humidityPlot = MeshLinePlot(color=[.5,0 ,.5, 1]) humidityPlot.points = [(int(i), int(humidY[i])) for i in range(0, 19)] humidityGraph.add_plot(humidityPlot) return humidityGraph
def setupGui(self): self.sogG = Graph( ymax=1.0, ymin=-1.0, ) self.sogP = MeshLinePlot(color=[1, 1, 0, 1]) self.sogG.add_plot(self.sogP) self.gui.rl.ids.flRace.add_widget(self.sogG)
def tempGraph(self): tempY =[] for i in range(len(self.fileData) - 19, len(self.fileData)): tempY.append(str(math.floor((float(self.fileData[i][6]))))) plot = None graph = Graph(size_hint = (.5,.8), ylabel='Outside Temperature (C)', xlabel = 'Time', x_ticks_major = 1, y_ticks_minor = 1, y_ticks_major = 1, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=0, xmax=20, ymin=-10, ymax=50, pos_hint = {'x': .24, 'y': .2}, background_color = [1,1,1,.2]) plot = MeshLinePlot(color = [1,1,1,1]) plot.points = [(int(i), int(tempY[i])) for i in range(0, 19)] graph.add_plot(plot) return graph
def __init__(self, game, screen, **kwargs): super(StateInfoBar, self).__init__(game, screen, **kwargs) # Right graph self.graph1 = graph1 = Graph(xlabel='Game', ylabel='Reward', x_ticks_major=self.DEFAULT_X_TICKS_MAJOR, y_ticks_major=self.DEFAULT_Y_TICKS_MAJOR, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=self.DEFAULT_XMIN, xmax=self.DEFAULT_XMAX, ymin=self.DEFAULT_YMIN, ymax=self.DEFAULT_YMAX) self.plot1 = plot1 = MeshLinePlot(color=[1, 0, 0, 1]) plot1.points = [] graph1.add_plot(plot1) self.ids["graph1"].add_widget(graph1) # Left graph self.graph2 = graph2 = Graph(xlabel='Generation', ylabel='MaxFitness', x_ticks_major=self.DEFAULT_X_TICKS_MAJOR, y_ticks_major=self.DEFAULT_Y_TICKS_MAJOR, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=self.DEFAULT_XMIN, xmax=self.DEFAULT_XMAX, ymin=self.DEFAULT_YMIN, ymax=self.DEFAULT_YMAX) self.plot2 = plot2 = MeshLinePlot(color=[0, 1, 0, 1]) plot2.points = [] graph2.add_plot(plot2) self.ids["graph2"].add_widget(graph2)
def __init__(self, **kwargs): # Configuracion de Elementos relacionados con la comunicación Serie self.maximos = [] self.ultimo_grafico = [] self.sensitivity = 2048 # conversion digital a G self.gravedad = 0 #constante para restar self.sampleRate = 1000 # SampleRate de Arduino self.fftSize = 2048 # Ventana para calcular la FFT self.AVERAGE = 2 # Variables lógicas usadas self.status = 0 self.cuentaFFT = 0 self.conectado = False self.modoForzadoOn = False self.graficosAmplitudDinamica = np.zeros(100) self.textosGraficosAmplitudDinamica = [] # Armado de app Widget con vinculo con archivo de estilo cistas.kv # Acomodar self.t_max = 10 # Tiempo en segundos que se muestran self.muestras_plot = self.t_max * self.sampleRate graph_wf = ObjectProperty(None) graph_sp = ObjectProperty(None) boton_on_libre = ObjectProperty(None) boton_on_forzado = ObjectProperty(None) slider = ObjectProperty(None) boton_velocidad = ObjectProperty(None) resetear = ObjectProperty(None) exportar = ObjectProperty(None) corregir = ObjectProperty(None) boton_conectar = ObjectProperty(None) texto_usuario = ObjectProperty(None) subir_velocidad = ObjectProperty(None) bajar_velocidad = ObjectProperty(None) guardar_maximo = ObjectProperty(None) calcular_parametros = ObjectProperty(None) texto_masa = ObjectProperty(None) super().__init__(**kwargs) # Graficos para el real_time self.plot_wf = MeshLinePlot(color=[1, 0.2, 0.3, 1]) self.plot_sp = MeshLinePlot(color=[0.8, 0.6, 0.9, 1]) self.plot_maximos = MeshLinePlot(color=[1, 0.2, 0.3, 1])
def __init__(self, obj: Trace, *args, **kwargs): super(TreeViewPlottable, self).__init__(*args, **kwargs) self.trace = obj # Make a plot self.plot = MeshLinePlot( color=[random.random(), random.random(), random.random(), 1]) self.plot.points = zip(self.trace.getx(), self.trace.gety()) self.text = str(obj)
def __init__(self): super(AccelerometerDemo, self).__init__() self.sensorEnabled = False self.graph = self.ids.acc.ids.graph_plot(xlabel="Time") self.stepCount = 0 self.zVals = [] # For all X, Y and Z axes self.plot = [] self.plot.append(MeshLinePlot(color=[1, 0, 0, 1])) # X - Red self.plot.append(MeshLinePlot(color=[0, 1, 0, 1])) # Y - Green self.plot.append(MeshLinePlot(color=[0, 0, 1, 1])) # Z - Blue self.reset_plots() for plot in self.plot: self.graph.add_plot(plot)
def draw_graph(self): sessions = App.get_running_app().root.loadDrill() screen_width = self.get_root_window().width self.xmax = 1 if len(sessions)== 0 else len(sessions) #numero de sessoes feitas if self.xmax <= self.X_TICKS_DEFAULT: self.width = screen_width if self.xmax > self.X_TICKS_DEFAULT: self.width = (screen_width)+((self.xmax - self.X_TICKS_DEFAULT)*(screen_width * self.RATIO_OF_TEN_TICKS)) plot = MeshLinePlot(color=[1, 1, 0, 1]) plot_start = PointPlot(color=[.7, .7, 0, 1], point_size=5) # print(plot.get_drawings()) self.remove_plot(plot) self.remove_plot(plot_start) plot.points = [((sessions.index(session)), round(session['accuracy']*100, 1)) for session in sessions] plot_start.points = [((sessions.index(session)), round(session['accuracy']*100, 1)) for session in sessions] self.add_plot(plot) self.add_plot(plot_start)
def all_graph(Shear_list, length, position, label): datapoints = np.arange(0, length, 0.01) point_data_list = [] multiplier = 1 if label == "Bending moment (kNm)" or label == "Deflection (1/EI)" or 'Axial Stress (kN)': multiplier = -1 ymax = 0 ymin = 0 min_y = 0 max_y = 0 for i in range(len(datapoints)): point_data = 0 for all in Shear_list: point_data += all.calculate(datapoints[i])*multiplier if point_data + abs(point_data / 5) > ymax: ymax = point_data + abs(point_data / 5) elif ymin > point_data - abs(point_data / 5): ymin = point_data - abs(point_data / 5) point_data_list.append((datapoints[i], point_data)) if i == 0: max_y = point_data min_y = point_data else: max_y = max(point_data, max_y) min_y = min(point_data, min_y) ymax = int(round(ymax, 0)) ymin = int(round(ymin, 0)) max_y = round(max_y, 3) min_y = round(min_y, 3) if ymax == 0: ymax = 1 if ymin == 0: ymin = -1 graph = Graph(pos_hint=position, size_hint=(0.7, 0.9), xlabel='Position', ylabel=label, x_ticks_minor=5, x_ticks_major=length / 10, x_grid_label=True, y_grid_label=True, y_ticks_major=(ymax-ymin)/5, y_ticks_minor=5, padding=5, x_grid=True, y_grid=True, xmax=length, xmin=0, ymin=ymin, ymax=ymax) plot = MeshLinePlot() plot.points = point_data_list graph.add_plot(plot) return graph, [min_y, max_y]
def perf_graph(self): global graph cpugraph = self.cpugraph cpuplot = MeshLinePlot(color=[1, 0, 1]) ramgraph = self.ramgraph RAMplot = MeshLinePlot(color=[0, 1, 0]) while True: for key in ['cpu', 'RAMpc']: if len(graph[key]) >= 100: del graph[key][0] if len(graph[key]) >= 100: del graph[key][0] #print (plot) #self.cpugraph.remove_plot(plot) graph['cpu'].append(int(psutil.cpu_percent())) graph['RAMpc'].append(psutil.virtual_memory().percent) RAMplot.points = [(i, j) for i, j in enumerate(graph['RAMpc'])] cpuplot.points = [(i, j) for i, j in enumerate(graph['cpu'])] try: self.ramgraph.add_plot(RAMplot) self.cpugraph.add_plot(cpuplot) except: pass #print (graph['cpu']) time.sleep(0.6)
def __init__(self, **kwargs): super().__init__() self.graph = Graph(x_ticks_minor=4, x_ticks_major=16, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=-0, xmax=SAMPLES, ymin=0, **kwargs) self.plot = MeshLinePlot(color=[1, 1, 0, 1]) self.plot.points = [(x, 0) for x in range(0, SAMPLES + 1)] self.graph.add_plot(self.plot) self.total_plot = MeshLinePlot(color=[0, 1, 1, 1]) self.total_plot.points = [(x, 0) for x in range(0, SAMPLES + 1)] self.graph.add_plot(self.total_plot) self.values = collections.defaultdict( lambda: [0 for x in range(0, SAMPLES + 1)])
def __init__(self, spec): self.spectrum = spec # The spectrum associated with this model self.params = None # For a sum of n functions, each accepting m # parameters, this becomes a flat array with # m * n elements self.trace = None # The prediction this model makes on the frequency domain # of the spectrum. # Representation of the model in the graph self.mesh = MeshLinePlot(color=[random(), random(), random(), 1]) self._bounds = None
def __init__(self, **kwargs): super().__init__(**kwargs) self.tictac = 0 print([type(widget) for widget in self.walk(loopback=True)]) self.plot = MeshLinePlot(color=[1, 0, 0, 1]) self.plot.points = [(x, sin(x / 10.)) for x in range(0, 101)] # Appel du widget avec l'id graph self.ids.graph.add_plot(self.plot) Clock.schedule_interval(self.update, 0.1)
def __init__(self, aircraft_config, **kwargs): super(AircraftLoadLayout, self).__init__(**kwargs) self.cols = 1 self.cfg = load_aircraft_config(aircraft_config) self.loads = create_loads_list(self.cfg) acft = self.cfg.aircraft self.lbl_info = Label(text="%s (%s)" % (acft.designation, acft.immat)) self.add_widget(self.lbl_info) self.sliders = SlidersLayout(self.cfg, self.loads) self.add_widget(self.sliders) self.lbl_center_gravity = Label(text="") self.add_widget(self.lbl_center_gravity) self.graph = Graph( xlabel="X", ylabel="mass", # x_ticks_minor=0.05, x_ticks_major=0.5, # y_ticks_major=100, # y_ticks_minor=20, y_grid_label=True, x_grid_label=True, padding=5, x_grid=True, y_grid=True, xmin=0.7, xmax=1.1, ymin=0, ymax=1000, ) self.mesh_line_plot = MeshLinePlot(color=[0, 0, 1, 1]) self.graph.add_plot(self.mesh_line_plot) self.add_widget(self.graph) self.btn_toggle = ToggleButton( text="lever arm / moment", group="xaxis", ) self.btn_toggle.bind(on_press=self.on_touch_move) self.add_widget(self.btn_toggle) # point = Point(0.8, 400) # plot = ScatterPlot(color=(1,0,0,1), pointsize=5) self.scatter_plot = ScatterPlot(color=[1, 0, 0, 1], point_size=5) # plot.points.append((0.8, 400)) self.graph.add_plot(self.scatter_plot) self.update_label_plot()
def update_plot_instructions(self): '''Updates the graphics instructions when the plot is shown/hidden. Returns True when the plot was shown/hidden and False otherwise. ''' changed = False vals = self.color_values rate = self.frame_rate for i, chan in enumerate('rgb'): active = getattr(self, '{}_btn'.format(chan)).state == 'down' plot_attr = '{}_plot'.format(chan) if active and not getattr(self, plot_attr): if not self.r_plot and not self.g_plot and not self.b_plot: with self.graph_canvas: c = Color(*get_color_from_hex('ebebeb')) r = Line() self.background = [r, c] color = [0, 0, 0, 1] color[i] = 1 plot = MeshLinePlot(color=color) plot.params['ymin'] = 0 plot.params['ymax'] = 1 add = self.graph_canvas.add for instr in plot.get_drawings(): add(instr) plot.ask_draw() setattr(self, plot_attr, plot) changed = True elif not active and getattr(self, plot_attr): changed = True plot = getattr(self, plot_attr) remove = self.graph_canvas.remove for instr in plot.get_drawings(): remove(instr) setattr(self, plot_attr, None) if not self.r_plot and not self.g_plot and not self.b_plot: for instr in self.background: remove(instr) self.background = [] return changed