I've been dealing with this detail for some time now, and there must be a simple solution to this. I am trying to plot a seaborn heatmap, i.e. where a is some matrix.
g=sns.heatmap(a).
This works fine, yet I do not want x and y labels at all, I just wish to mark specific values, e.g. x ticks:
for label in g.ax_heatmap.xaxis.get_majorticklabels():
if label.get_text() in to_mark:
label.set_size(10)
label.set_weight("bold")
label.set_color("red")
label.set_text("I do not work")
The problem occurs at the last line, where I try to rename the labels from current longer namest to just "", for example. My question is, why does label.set_text("") not do the job? And what are possible alternatives.
Thank you!
EDIT:
"working" example
df = pd.DataFrame.from_dict(midframe)
cmap1 = sns.cubehelix_palette(as_cmap=True, rot=-.3, light=1)
g = sns.clustermap(a,cmap=cmap1,xticklabels=True,yticklabels=False)
top = [str(x) for x in range(0,10)]
for label in g.ax_heatmap.xaxis.get_majorticklabels():
if label.get_text() in top:
label.set_size(10)
label.set_weight("bold")
label.set_color("red")
plt.show()