I’m plotting some districts indicators in a heatmap and I wanted to highlight the selected districts by coloring them red in the y axis (each tick in the yaxis is a district name). I know in matplotlib you can loop through each tick, but here I’m not finding anything. Is there any way I can do this?
The relevant piece of my code is this one:
colors = ['black']*len(ranking)
idx = (ranking[ranking.district.isin(selected_districts)]).index.values
for i in idx:
colors[i] = 'red'
fig.update_yaxes(color=colors)
As color doesn’t accept an array, my approach isn’t working. Is there any way with a lower level API to achieve this? I know this isn't a reproducible example, but my question is quite generic and data independent, but if needed I can add one.
Edit:
Working example:
import plotly.figure_factory as ff
y = ['1a', '2b', '3c']
x = [1, 2]
z = [[3,4],[5,7],[8,9]]
fig = ff.create_annotated_heatmap(x=x, y=y, z=z)
Let's say I want to make the 2b tick red. How could I do that?
