How to get interactive plot of pyplot when using jupyter pycharm

Viewed 1004

Is it possible to get interactive plot when using jupyter in PyCharm IDE ? If not, Why ?

By interactive plot I mean a plot in a window where I can zoom.

I tried this, but python always crash :

#%%
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl

mpl.use('TkAgg')  # or can use 'TkAgg', whatever you have/prefer 'Qt5Agg'


# Data for plotting
t = np.arange(0.0, 2.0, 0.00001)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.set(xlabel='time (s)', ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax.grid()

plt.show()

enter image description here

1 Answers
Related