THE TECHIE HAND
THE TECHIE HAND

Reputation: 466

UserWarning in matplotlib

I am trying to plot a graph using the following code:

import numpy as np
import matplotlib.pyplot as plt
arr = np.random.randint(1,50,10)
print(arr)
y, x = np.histogram(arr,bins=np.arange(51))
fig, ax = plt.subplots()
ax.plot(x[:-1],y)
fig.show()

The error displayed is:

<ipython-input-4-31fe4acba862>:8: UserWarning: Matplotlib is currently using module://ipykernel.pylab.backend_inline, which is a non-GUI backend, so cannot show the figure.

Although I still get a graph: Graph I get..

Upvotes: 1

Views: 860

Answers (1)

tdy
tdy

Reputation: 41327

The warning comes from fig.show(). You can remove this when using jupyter.

Upvotes: 2

Related Questions