Google colaboratory googlecolab中的不完全图
大家好 两周前,我的pyplots图表运行良好。Hoever本周使用相同的代码,他们没有在y_轴上正确绘制。我提前感谢你的帮助。请在下面找到一个指向示例笔记本的链接,以及我使用seabrone库从这里获取的示例代码[2] 在下图中,您可以看到第一行和最后一行不完整 或者,您可以复制以下代码:Google colaboratory googlecolab中的不完全图,google-colaboratory,Google Colaboratory,大家好 两周前,我的pyplots图表运行良好。Hoever本周使用相同的代码,他们没有在y_轴上正确绘制。我提前感谢你的帮助。请在下面找到一个指向示例笔记本的链接,以及我使用seabrone库从这里获取的示例代码[2] 在下图中,您可以看到第一行和最后一行不完整 或者,您可以复制以下代码: import seaborn as sn import pandas as pd import matplotlib.pyplot as plt array = [[33,2,0,0,0,0,0,0,0,1
import seaborn as sn
import pandas as pd
import matplotlib.pyplot as plt
array = [[33,2,0,0,0,0,0,0,0,1,3],
[3,31,0,0,0,0,0,0,0,0,0],
[0,4,41,0,0,0,0,0,0,0,1],
[0,1,0,30,0,6,0,0,0,0,1],
[0,0,0,0,38,10,0,0,0,0,0],
[0,0,0,3,1,39,0,0,0,0,4],
[0,2,2,0,4,1,31,0,0,0,2],
[0,1,0,0,0,0,0,36,0,2,0],
[0,0,0,0,0,0,1,5,37,5,1],
[3,0,0,0,0,0,0,0,0,39,0],
[0,0,0,0,0,0,0,0,0,0,38]]
df_cm = pd.DataFrame(array, index = [i for i in "ABCDEFGHIJK"],
columns = [i for i in "ABCDEFGHIJK"])
plt.figure(figsize = (10,7))
sn.heatmap(df_cm, annot=True)
## Retrieved from https://stackoverflow.com/questions/35572000/how-can-i-plot-a-confusion-matrix
我已经解决了,或者至少我找到了问题的原因。matplotlib已更新。最新版本是3.1.1,我使用的是3.1.0。因此,我使用以下命令在colab上安装了3.1.0版本。之后一切都恢复了正常
#This was the code for changing the matplotlib version in Google Colab:
! pip install matplotlib==3.1.0