Python 谷歌colab中的混淆矩阵被切掉了

Python 谷歌colab中的混淆矩阵被切掉了,python,visualization,google-colaboratory,confusion-matrix,Python,Visualization,Google Colaboratory,Confusion Matrix,我试图通过以下代码可视化我的混淆矩阵: from mlxtend.plotting import plot_confusion_matrix import matplotlib.pyplot as plt import numpy as np import sklearn as skplt import scikitplot as skplt skplt.metrics.plot_confusion_matrix(y_val, autokeras_predictions, figsize = (

我试图通过以下代码可视化我的混淆矩阵:

from mlxtend.plotting import plot_confusion_matrix
import matplotlib.pyplot as plt
import numpy as np
import sklearn as skplt
import scikitplot as skplt
skplt.metrics.plot_confusion_matrix(y_val, autokeras_predictions, figsize = (5, 5), title= 'My confusionmatrix' )
plt.figure(figsize = (10,7))
但它切断了我上面和下面的困惑矩阵。(见图)


有人能帮我吗?谢谢

我也有同样的问题

我正在Windows上使用
Anaconda

对我来说,以下解决了问题:

from mlxtend.plotting import plot_confusion_matrix
...
multiclass = confusion_matrix(test_y, predictions)
class_names = ['16QAM', '32QAM', '64QAM', 'BPSK', 'QPSK', '8PSK']

fig, ax = plot_confusion_matrix(conf_mat=multiclass, colorbar=True,
show_absolute=False, show_normed=True, class_names=class_names)
-->ax.margins(2,2) #just change the values til adjust to your screen.
plt.show()

可能存在的副本