Yticklabels colour specific indexes

Dear Matplotlib Community,

I want to plot a set of data and colour-code the list of ylabels in two ways. I tried in this way
ax.get_yticklabels()[0].set_color("red") but I need it to work for multiple indexes and not only one.

Will appreciate any help and suggestions

Just loop through the indices you’d like?

Thank you for your prompt reply and suggestion.

Let me leave the solution here for anyone that might have the same issue:

for ind in range (0, 3):
ax[0].get_yticklabels()[ind].set_color("red")