FuncAnimation shows no data points or animation in Mac OS

I am using PyCharm 2020.1 Professional version in iMac, macOS Catalina 10.15.4. The following animation example code (from Matplotlib's doc) produces no data points. The code runs without error but all I see is an empty plot. Can anyone help me here?

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation

fig, ax = plt.subplots()
xdata, ydata = [], []
ln, = plt.plot([], [], 'ro')

def init():
ax.set_xlim(0, 2*np.pi)
ax.set_ylim(-1, 1)
return ln,

def update(frame):
xdata.append(frame)
ydata.append(np.sin(frame))
ln.set_data(xdata, ydata)
return ln,

ani = FuncAnimation(fig, update, frames=np.linspace(0, 2*np.pi, 128),
init_func=init, blit=True)
plt.show()




 

2 comments
Comment actions Permalink

I'm having the same issue

 

0
Comment actions Permalink

Hello, 

Unfortunately, it is not supported yet, please vote for this ticket 

https://youtrack.jetbrains.com/issue/PY-27233

 

As a workaround, please disable "Show plots in tool window" under  Settings/Preferences |  Tools | Python Scientific. 

0

Please sign in to leave a comment.