While plotting heatmaps using seaborn, the numbers are getting printed on the boundary of the heatmap. I have already plotted heatmaps many times using the same code. It used to work well but, I'm facing this issue of misalignment.
Code used
#Defining a custom function
def get_confusion_matrix(clf,X_te,y_test):
y_pred = clf.predict(X_te)
df_cm = pd.DataFrame(confusion_matrix(y_test, y_pred), range(2),range(2))
df_cm.columns = ['Predicted NO','Predicted YES']
df_cm = df_cm.rename({0: 'Actual NO', 1: 'Actual YES'})
sns.set(font_scale=1.4)#for label size
sns.heatmap(df_cm, annot=True,annot_kws={"size": 16}, fmt='d',cmap="YlGnBu", linewidths=5)
#Using the function to plot the heatmap
get_confusion_matrix(model_s1,X_tr,y_train_1)