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.

0

1 Answer 1

1

Use:

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

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

Sign up to request clarification or add additional context in comments.

2 Comments

A little more explanation why this will solve the issue would be nice.
Confirming this does work, but only when the backend is seaborn. Why is that?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.