无法在Google Colab中绘制图形

阿舒·库玛(Ashu kumar)

我正在尝试在Google Colab中绘制图形

fig = plt.figure()
plt.title("Weight matrices after model trained")
plt.subplot(1, 3, 1)
plt.title("Trained model Weights")
ax = sns.violinplot(y=h1_w,color='b')
plt.xlabel('Hidden Layer 1')

plt.subplot(1, 3, 2)
plt.title("Trained model Weights")
ax = sns.violinplot(y=h2_w, color='r')
plt.xlabel('Hidden Layer 2 ')

plt.subplot(1, 3, 3)
plt.title("Trained model Weights")
ax = sns.violinplot(y=out_w,color='y')
plt.xlabel('Output Layer ')
plt.show()

该图未绘制,并且也显示警告-/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:8:RuntimeWarning:已打开20多个数字。通过pyplot接口(matplotlib.pyplot.figure创建的图形将保留到显式关闭,并且可能会占用过多内存。(要控制此警告,请参阅rcParam figure.max_open_warning)。

ro如何解决此问题

jakevdp

听起来您无意中启用了另一个matplotlib绘图后端(也许您使用%matplotlib魔术更改了后端?)

为了使绘图恢复正常,请重新启动运行时或在当前运行时运行

%matplotlib inline
plt.close('all')

并且在将来,请避免更改绘图后端。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章