Closed
Description
Bug summary
After showing interactive figure, the CPU utilization of python process went to 100%.
Code for reproduction
#######################################################
# Case 1: 100% cpu
import matplotlib.pyplot as plt
fig = plt.figure()
plt.plot(range(5))
plt.show()
# after closing the window
import pandas # starting 100% CPU utilization
#######################################################
# Case 2: 100% cpu
import matplotlib.pyplot as plt
import pandas as pd
# No CPU utilization at the moment
fig = plt.figure()
df = pd.DataFrame(range(5))
plt.plot(df[0]) # with this, CPU utilization is 100%.
plt.show() # the same
# after closing the window, still 100%
#######################################################
# Case 3: no issue.
import matplotlib.pyplot as plt
fig = plt.figure()
plt.plot(range(5))
plt.show() # strangely, this has no problem.
Actual outcome
no problem except it consumes 100% cpu. The figure is still responsive.
Expected outcome
matplotlib backend should not consume 100% cpu.
Additional information
-
pandas version 2.2.3 (pip)
-
Certain operation (closing interactive figures) causes 100% cpu with 'macosx' backend.
-
Closing the figure, or calling
plt.close()
does not help. (backend: macosx) -
No problem with
qt5agg
backend.
Operating system
Mac (Intel) Ventura 13.6.6
Matplotlib Version
3.9.2
Matplotlib Backend
macosx
Python version
Python 3.12.3
Jupyter version
No response
Installation
pip