0

I am trying to plot a confusion matrix using scikitplot.metrics.plot_confusion_matrix by following snippet code-

import scikitplot as skplt

Y_Test = [1, 0, 1, 0, 1, 1, 0, 1, 1 ,1 ,1, 1, 0, 0 ,0];
Y_Pred = [1, 0, 0, 0, 1, 1, 0, 1, 1 ,1 ,1, 1, 1, 0 ,0];
cm = skplt.metrics.plot_confusion_matrix(Y_Test,Y_Pred,normalize=True, text_fontsize = 'large')

However, I am not quite getting the expected result as shown in the figure (somehow, the text is overlapping with the axis). How can I make it neat and clean?

enter image description here

user3862410
  • 171
  • 1
  • 6
  • you can use matplotlib & sklearn.metrics.confusion_matrix for better result with more control on your plot like x tick, y tick etc – Jahangir Alam Nov 14 '19 at 03:26
  • you can see this example https://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py – Jahangir Alam Nov 14 '19 at 03:30

1 Answers1

0

Firstly check the version of the matplotlib installed. The problem is with the "imshow" function which scikitplot uses internally. Until it gets fixed, please uninstall the present matplotlib version and install '3.0.3' version using following commands.

pip uninstall matplotlib
pip install matplotlib=='3.0.3'
Harish Vutukuri
  • 1,092
  • 6
  • 14