4

How can the size of a pandas_ml confusion matrix image with lots of classes be increased so the labels are clearly visible?

Such an image can be generated in Jupyter like this:

import pandas as pd
from pandas_ml import ConfusionMatrix
import matplotlib.pyplot as plt
import string
%matplotlib inline

classes = string.printable # 100 target classes
df = pd.DataFrame({'true':list(classes*10),
                   'pred':sorted(classes*2)+list(classes*8)
                  })
cm = ConfusionMatrix(df['true'],df['pred'])
cm.plot()

enter image description here

I've tried various suggestions involving changing figure sizes and subfigure sizes, as well as looking for size or width in the pandas_ml docs but nothing has worked so far.

user1717828
  • 7,122
  • 8
  • 34
  • 59

1 Answers1

1

Use:

plt.figure(figsize=(20,20))

cm.plot(normalized=True, backend="seaborn")