Eat matplotlib deprecation warning

matplotlib is issuing a deprecation warning whenever you use rcParams,
even if you are not using one of the deprecated values. This is
very annoying. I eat the deprecation while using rcParams.

https://github.com/matplotlib/matplotlib/issues/13118
This commit is contained in:
Roger Labbe 2020-04-26 19:04:53 -07:00
parent 181f857ae7
commit b4e8c056e0
1 changed files with 7 additions and 2 deletions

View File

@ -58,7 +58,9 @@ def test_filterpy_version():
# chapter so the reader can see that they need to update FilterPy.
test_filterpy_version()
pylab.rcParams['figure.max_open_warning'] = 50
with warnings.catch_warnings():
warnings.simplefilter("ignore", matplotlib.MatplotlibDeprecationWarning)
pylab.rcParams['figure.max_open_warning'] = 50
@contextmanager
@ -110,7 +112,10 @@ def set_style():
style = json.load(open("./kf_book/538.json"))
else:
style = json.load(open(".//kf_book/538.json"), object_hook=_decode_dict)
plt.rcParams.update(style)
with warnings.catch_warnings():
warnings.simplefilter("ignore", matplotlib.MatplotlibDeprecationWarning)
plt.rcParams.update(style)
except:
pass
np.set_printoptions(suppress=True, precision=3,