I have a plot with a list of labels. What I'd like to do is color code each label based on the string. So, for instance, all labels with the string ':Q_D' would refer to quadrupoles and should get a certain color. The other substrings to color by are ':DCH_D' and ':DCV_D' for horizontal and vertical corrector magnets.
I see that you can change the color of all xtick labels using this: plt.xticks(color='r')
but I'd like to have them individually colored. Is this possible?