I'm trying to plot a confusion matrix with seaborn. here is my code:
u=['Fire','No Fire']
v=['Fire','No Fire']
plt.figure(figsize=(5,5),dpi=500)
plt.rcParams["font.family"] = "serif"
plt.rcParams["font.serif"] = "Times New Roman"
b=sns.heatmap(cmat,fmt='.2%',annot=True,cmap='RdYlGn',linewidths=.5,yticklabels=u,xticklabels=v)
b.set_yticklabels(u, size = 10)
b.set_xticklabels(v, size = 10)
plt.yticks(weight = 'bold')
plt.xticks(weight = 'bold')
plt.ylabel('Actual',fontsize=18,fontweight='bold')
plt.xlabel('Predicted',fontsize=18,fontweight='bold')
plt.savefig('conf.png', dpi=500,bbox_inches='tight')
When I run this code TP,FN,TN and TN doesn't align center and return a plot like this:
Can anyone help me to solve this?