reiinakano / scikit-plot

An intuitive library to add plotting functionality to scikit-learn objects.
MIT License
2.43k stars 284 forks source link

Confusion Matrix plots are confusing with long categories #37

Closed ExcaliburZero closed 7 years ago

ExcaliburZero commented 7 years ago

When you create a confusion matrix plot for a classification problem that has a lot of categories with long names, the names for the "Predicted label" axis can overlap, causing the axis to become unreadable. Even using large dimensions for the figsize parameter isn't enough in some cases.

Here is an example.

scikit_plot_01

Perhaps there could be a new optional parameter added to allow the labels on the "Predicted label" axis to be rotated 90 degrees in order to make them easier to read.

ExcaliburZero commented 7 years ago

This issue can also occur in other similar cases, such as creating variable importance plots with lots of variables that have long names.

scikit_plot_02

reiinakano commented 7 years ago

Thanks for pointing this out! I've fixed it in 0.2.7 just released now!

You can now do plot_confusion_matrix(..., x_tick_rotation=90)

ExcaliburZero commented 7 years ago

Thanks! It works great now.

scikit_plot_03