The following is the explanation for the preceding code:
- The first three steps of reading the data, defining the figure, and plotting various line graphs are already familiar to us.
- lgd = plt.legend(loc='lower right', fancybox=True, shadow=True) sets the legend, fancybox=True specifies to draw a bounding box around the legend items, and shadow=True specifies that the bounding box to have a shadow.
- pltlines = [l1, l2, l3, l4, l5, l6, l7, l8] is the list of all plot lines in the figure.
- leg_ln_map = dict() is the dictionary mapping plot lines to the corresponding legend labels.
- for loop sets the picker for each of the legend labels and maps them to the corresponding line plots.
- leg_line.set_picker(5) sets the picker for the ...