From d6a9d0257f2a2af3f60b8c9b0f18ada55811c568 Mon Sep 17 00:00:00 2001 From: mmichalek Date: Wed, 15 Jan 2020 11:37:23 +0100 Subject: [PATCH 1/2] exchange of matplotlib deprecated methods to new ones --- confusion_matrix_pretty_print.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/confusion_matrix_pretty_print.py b/confusion_matrix_pretty_print.py index eb3158b..964508a 100644 --- a/confusion_matrix_pretty_print.py +++ b/confusion_matrix_pretty_print.py @@ -162,11 +162,11 @@ def pretty_plot_confusion_matrix(df_cm, annot=True, cmap="Oranges", fmt='.2f', f # Turn off all the ticks for t in ax.xaxis.get_major_ticks(): - t.tick1On = False - t.tick2On = False + t.tick1line.set_visible = False + t.tick2line.set_visible = False for t in ax.yaxis.get_major_ticks(): - t.tick1On = False - t.tick2On = False + t.tick1line.set_visible = False + t.tick2line.set_visible = False #face colors list quadmesh = ax.findobj(QuadMesh)[0] From a931662784d8a2d9ae713d52106712e2a9e9accd Mon Sep 17 00:00:00 2001 From: mmichalek Date: Wed, 15 Jan 2020 11:38:34 +0100 Subject: [PATCH 2/2] axis settings: avoiding cutting off edges --- confusion_matrix_pretty_print.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/confusion_matrix_pretty_print.py b/confusion_matrix_pretty_print.py index 964508a..3357ecc 100644 --- a/confusion_matrix_pretty_print.py +++ b/confusion_matrix_pretty_print.py @@ -160,6 +160,10 @@ def pretty_plot_confusion_matrix(df_cm, annot=True, cmap="Oranges", fmt='.2f', f ax.set_xticklabels(ax.get_xticklabels(), rotation = 45, fontsize = 10) ax.set_yticklabels(ax.get_yticklabels(), rotation = 25, fontsize = 10) + # axis settings: avoiding cutting off edges + bottom, top = ax.get_ylim() + ax.set_ylim(bottom + 0.5, top - 0.5) + # Turn off all the ticks for t in ax.xaxis.get_major_ticks(): t.tick1line.set_visible = False