Skip to content

Commit

Permalink
Remove a bazillion of MatplotlibDeprecationWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Xarthisius committed Jul 19, 2020
1 parent f4d93c1 commit 0dfefca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 6 additions & 4 deletions yt/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import urllib.parse
import urllib.request
import warnings
from distutils.version import LooseVersion
from functools import wraps
from math import ceil, floor
from numbers import Number as numeric_type
Expand Down Expand Up @@ -1266,10 +1267,11 @@ def matplotlib_style_context(style_name=None, after_reset=False):
available, returns a dummy context manager.
"""
if style_name is None:
style_name = {
"mathtext.fontset": "cm",
"mathtext.fallback_to_cm": True,
}
style_name = {"mathtext.fontset": "cm"}
if LooseVersion(matplotlib.__version__) >= LooseVersion("3.3.0"):
style_name["mathtext.fallback"] = "cm"
else:
style_name["mathtext.fallback_to_cm"] = True
try:
import matplotlib.style

Expand Down
4 changes: 3 additions & 1 deletion yt/visualization/base_plot_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ def save(self, name, mpl_kwargs=None, canvas=None):

if mpl_kwargs is None:
mpl_kwargs = {}
if "papertype" not in mpl_kwargs:
if "papertype" not in mpl_kwargs and LooseVersion(
matplotlib.__version__
) < LooseVersion("3.3.0"):
mpl_kwargs["papertype"] = "auto"

suffix = get_image_suffix(name)
Expand Down

0 comments on commit 0dfefca

Please sign in to comment.