def eligibleClick(self, buttonClicked): if buttonClicked == "next": return (not FigureControl.isVisible( FigureControl.maxPossibleGenNumber), "max gen already displayed") elif buttonClicked == "prev": return (not FigureControl.isVisible( FigureControl.minPossibleGenNumber), "min gen already displayed") elif buttonClicked == "movie": return True, "" else: return False, "bad button"
def onpick(cls, event): """mouse pick event on fitness plot""" event_len = len(event.ind) if not event_len: return True value = event.ind[-1] + FigureControl.minPossibleGenNumber vis_now = FigureControl.isVisible(value) FigureControl.makeGenVisible(value, not vis_now, "dist")
def button_1(cls, cloud_plot, artist, ind): """click with button 1, i.e., left button""" is_parent = cloud_plot.is_parent_artist(artist, ind) gen = cloud_plot.artist2gen[artist] if is_parent: vis_now = FigureControl.isVisible(gen) FigureControl.makeGenVisible(gen, not vis_now, "dist") else: row_idx = cloud_plot.artist2data[artist][ind] for cpl in gs.cloud_plots: this_data = cpl.fetch_child_data_point(gen, row_idx) cpl.show_new_labels_dp(this_data) FigureControl.draw_all_cloud_plots() cloud_plot.button_1(artist, ind)
def update(self, value): """update the fitness plot""" if value < 0: self.dot.set_data([[value], [-1]]) self.ax.set_title("") else: self.dot.set_data([[value], [self.y[value-self.x[0]]]]) self.ax.set_title("Gen {} Fitness {:.8f} ".format(value, self.y[value-self.x[0]])) vis_now = FigureControl.isVisible(value) if not vis_now: FigureControl.makeGenVisible(value, True, "dist", skip_fitness_plot=True) self.fig.canvas.draw()