0

I am using the following piece of python code to generate a normalized confusion matrix

import scikitplot as skplt 
skplt.metrics.plot_confusion_matrix(y_test, y_pred, normalize=True)

and this gives me the plot as shown here. However, I wanted to rotate the texs on the x-axis (the predicted values, i.e., neutral, happy, sad). Instead of in a horizontal line, I want the predicted values on the x-axis to be rotated (as shown in here) and keep the true labels as they are (horizontal).How can we do this in Python?

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

0

If you want to use scikitplot, I believe there is x_tick_rotation argument in the plot_confusion_matrix function. So you could rotate xticks to 45 degrees as follows.

skplt.metrics.plot_confusion_matrix(y_test, y_pred, x_tick_rotation=45, normalize=True)
Achintha Ihalage
  • 2,310
  • 4
  • 20
  • 33