How can I achieve that using matplotlib?
Here is my code with the data you provided. As there's no class [they are all different, despite your first example in your question does have classes], I gave colors based on the numbers. You can definitely start alone from here, whatever result you want to achieve. You just need
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt # import xls df=pd.read_excel('data.xlsx') # exclude Ranking values df1 = df.ix[:,1:-1] # for each element it takes the value of the xls cell df2=df1.applymap(lambda x: float(x.split('\n'))) # now plot it df_heatmap = df2 fig, ax = plt.subplots(figsize=(15,15)) sns.heatmap(df_heatmap, square=True, ax=ax, annot=True, fmt="1.3f") plt.yticks(rotation=0,fontsize=16); plt.xticks(fontsize=12); plt.tight_layout() plt.savefig('dfcolorgraph.png')