How to get interactive plot of pyplot when using jupyter pycharm

2.1k views Asked by At

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

There are 1 answers

0
alshan On

You can give a try to the "Let's-Plot in SciView" plugin for PyCharm. It doesn't provide zooming controls but you can achieve the effect by adjusting xlim/ylim options in coordinate system.

Plugin: https://plugins.jetbrains.com/plugin/14379-lets-plot-in-sciview

Docs: https://lets-plot.org/