The following is the explanation of the preceding code steps:
- The first three steps are defining the figure and its layout, preparing the data, and plotting the charts.
- figure_enter(event) is the callback function that responds to figure_enter_event.
- print('figure_enter', event.canvas.figure) prints the text figure enter followed by the figure object, to sysout.
- event.canvas.figure.patch.set_facecolor('grey') sets the face color of the figure to grey.
- event.canvas.draw() plots the updated figure on the output device.
- figure_exit(event) is the callback function that responds to figure_leave_event. This function also prints the text to sysout, sets the face color of the figure to red, and plots the updated figure.
- axes_enter(event) ...