Skip to content

Commit

Permalink
Suppress warnings about deprecated rcParams in matplotlib>=3.0 (#3013)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Oct 25, 2018
1 parent 264c831 commit 2b3de81
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions holoviews/plotting/mpl/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
from ..plot import (DimensionedPlot, GenericLayoutPlot, GenericCompositePlot,
GenericElementPlot)
from ..util import attach_streams, collate, displayable
from .util import compute_ratios, fix_aspect
from .util import compute_ratios, fix_aspect, mpl_version


@contextmanager
def _rc_context(rcparams):
"""
Context manager that temporarily overrides the pyplot rcParams.
"""
old_rcparams = mpl.rcParams.copy()
deprecated = ['text.latex.unicode', 'examples.directory']
old_rcparams = {k: mpl.rcParams[k] for k in mpl.rcParams.keys()
if mpl_version < '3.0' or k not in deprecated}
mpl.rcParams.update(rcparams)
try:
yield
Expand Down
4 changes: 4 additions & 0 deletions holoviews/plotting/mpl/util.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import re
import warnings
from distutils.version import LooseVersion

import numpy as np
import matplotlib
from matplotlib import ticker
from matplotlib.transforms import Bbox, TransformedBbox, Affine2D

mpl_version = LooseVersion(matplotlib.__version__) # noqa

from ...core.util import basestring, _getargspec
from ...element import Raster, RGB

Expand Down

0 comments on commit 2b3de81

Please sign in to comment.