I am looking to change the color of the ticklabels in my heatmap based on some condition. For example below, I would like to change the colors of ticklabels containing A as red and B as green.
I tried making a list ['red', 'green', 'red', 'green'] and pass it along the color option but no success so far. Any help would be great.
import numpy as np
import matplotlib.pyplot as plt
alpha = ['ABC', 'BDF', 'ADF', 'BCF']
data = np.random.random((4,4))
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.matshow(data, interpolation='nearest')
fig.colorbar(cax)
ax.set_xticklabels(['']+alpha)
ax.set_yticklabels(['']+alpha)
plt.show()

