1

I am trying to plot the graph in 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()

The graph is not getting plotted and also its showing a warning - /usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:8: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (matplotlib.pyplot.figure) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam figure.max_open_warning).

How ro resolve this issue

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Ashu kumar
  • 37
  • 2
  • 9
  • 1
    Does this answer your question? [matplotlib get rid of max\_open\_warning output](https://stackoverflow.com/questions/27476642/matplotlib-get-rid-of-max-open-warning-output) – isydmr Mar 21 '20 at 10:53
  • Now, the warning is removed. but still the graph is not getting plotted. Nothing is showing after plt.show() command – Ashu kumar Mar 21 '20 at 11:01

1 Answers1

9

It sounds like you've inadvertently enabled a different matplotlib plotting backend (perhaps you changed the backend using the %matplotlib magic?)

To get your plotting back to normal, either restart your runtime, or in the current runtime run

%matplotlib inline
plt.close('all')

and in the future, avoid changing the plotting backend.

jakevdp
  • 77,104
  • 11
  • 125
  • 160