Shantanu Neema
Shantanu Neema

Reputation: 43

incorrect confusion matrix plot

The ends on y-axis cuts halfway while plotting confusion matrix using pandas dataframe?

This is what I get:

Click to see the plot

I used the codes from here How can I plot a confusion matrix? using pandas dataframe:

import seaborn as sn
import pandas as pd
import matplotlib.pyplot as plt

array = [[13,1,1,0,2,0],
    [3,9,6,0,1,0],
    [0,0,16,2,0,0],
    [0,0,0,13,0,0],
    [0,0,0,0,15,0],
    [0,0,1,0,0,15]]        
df_cm = pd.DataFrame(array, range(6),range(6))
#plt.figure(figsize = (10,7))
sn.set(font_scale=1.4)#for label size
sn.heatmap(df_cm, annot=True,annot_kws={"size": 16})# font size

Upvotes: 3

Views: 1228

Answers (2)

purushotam radadia
purushotam radadia

Reputation: 49

As suggested by sikisis

Following solved my problem

pip install matplotlib==3.1.0

Upvotes: 0

sikisis
sikisis

Reputation: 478

I solved the problem and I think this post explains why it happens.

Simply speaking, matplotlib 3.1.1 broke seaborn heatmaps; You can solve it by downgrading to matplotlib 3.1.0.

Upvotes: 2

Related Questions