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 e249fbc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 8 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,13 @@ 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,
}
import matplotlib

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 e249fbc

Please sign in to comment.