October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following steps of code implement the logic we need:
class Cluster(object): ind = 0 # index to move back and forth as we click prev and next buttons# Method for next button click def next(self, event): self.ind += 1 i = self.ind % len(species) index = iris['species'] == species[i] axs.clear() axs.scatter(x[index], y[index], s=50, marker='o') axs.set_title(species[i], size=25, color='r') plt.draw()# Method for prev button click def prev(self, event): self.ind -= 1 i = self.ind % len(species) index = iris['species'] == species[i] axs.clear() axs.scatter(x[index], y[index], s=50, marker='o') axs.set_title(species[i], size=25, color='r') ...
Read now
Unlock full access