November 2018
Beginner to intermediate
214 pages
5h 2m
English
Just like with the slider, we can add a callback in the code that will change the color of our output. By doing this, we can switch between cyan, blue, and black:
# Radio Buttonsax1 = plt.axes([0.05, 0.1, 0.65, 0.8])curve, = ax1.plot(nums, np.sin(nums))ax2 = plt.axes([0.75, 0.1, 0.15, 0.3])colors = ('cyan', 'blue', 'black')color = RadioButtons(ax2, colors)def setcolor(color): curve.set_color(color) plt.gcf().canvas.draw()# color.on_clicked(setcolor)
We will get the following code:

Now, we want to use a selector to select the points in the plot. By doing this, we can generate the selector ...
Read now
Unlock full access