import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
data = pd.read_csv("input.tsv",sep="\t",index_col=0)
fig, ax = plt.subplots()
hmp = sns.heatmap(data,xticklabels=1, yticklabels=1, ax=ax)
hmp.set_title("Title")
fig.savefig("example.pdf")

I create a heatmap with seaborn. How can I achieve that the labels on the x axis would be all different colors based on some grouping? E.g. the first two are blue, the third is red, the fourth is green, the fifth is blue again.

0 Answers