How do I fix the deprecation warning that comes with pylab.pause?


To fix the deprecation warning that comes while using a deprecated method, we can use warnings.filterwarnings("ignore") in the code.−

Example

from matplotlib import pyplot as plt, pylab as pl
import warnings

plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True

warnings.filterwarnings("ignore")

pl.pause(0)
plt.show()

Output

Process finished with exit code 0

Updated on: 05-Jun-2021

157 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements