Here is the explanation of the preceding code blocks.
The first four steps are already familiar, so we will explain from step 5:
- lines = [l1, l2, l3, l4, l5, l6, l7, l8] is the list of all the ROC line plots.
- cax = plt.axes([0.05, 0.27, 0.15, 0.5]) defines the axes where the CheckButtons box is plotted.
- labels = [str(line.get_label()) for line in lines] defines the list of labels for each of the ROC plots. This is the same as the labels we gave when we plotted these curves. Instead of hardcoding again here, we are using the system function line.get_label() to get them.
- visibility = [line.get_visible() for line in lines] is a list of visibility status (visible or invisible) for all the ROC curves.
- check = CheckButtons(cax, ...