Skip to content

Commit

Permalink
Merge e6ed80d into f236fc8
Browse files Browse the repository at this point in the history
  • Loading branch information
poplarShift committed Mar 30, 2020
2 parents f236fc8 + e6ed80d commit b5f3721
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
13 changes: 2 additions & 11 deletions holoviews/plotting/mpl/plot.py
Expand Up @@ -20,24 +20,15 @@
from ..plot import (DimensionedPlot, GenericLayoutPlot, GenericCompositePlot,
GenericElementPlot, GenericAdjointLayoutPlot)
from ..util import attach_streams, collate, displayable
from .util import compute_ratios, fix_aspect, mpl_version
from .util import compute_ratios, fix_aspect, get_non_deprecated_rcparams


@contextmanager
def _rc_context(rcparams):
"""
Context manager that temporarily overrides the pyplot rcParams.
"""
deprecated = [
'text.latex.unicode',
'examples.directory',
'savefig.frameon', # deprecated in MPL 3.1, to be removed in 3.3
'verbose.level', # deprecated in MPL 3.1, to be removed in 3.3
'verbose.fileo', # deprecated in MPL 3.1, to be removed in 3.3
'datapath', # deprecated in MPL 3.2.1, to be removed in 3.3
]
old_rcparams = {k: mpl.rcParams[k] for k in mpl.rcParams.keys()
if mpl_version < '3.0' or k not in deprecated}
old_rcparams = get_non_deprecated_rcparams()
mpl.rcParams.clear()
mpl.rcParams.update(dict(old_rcparams, **rcparams))
try:
Expand Down
14 changes: 2 additions & 12 deletions holoviews/plotting/mpl/renderer.py
Expand Up @@ -18,7 +18,7 @@
from ...core import HoloMap
from ...core.options import Store
from ..renderer import Renderer, MIME_TYPES, HTML_TAGS
from .util import get_tight_bbox, mpl_version
from .util import get_tight_bbox, get_non_deprecated_rcparams

class OutputWarning(param.Parameterized):pass
outputwarning = OutputWarning(name='Warning')
Expand Down Expand Up @@ -230,17 +230,7 @@ def _compute_bbox(self, fig, kw):
@classmethod
@contextmanager
def state(cls):
deprecated = [
'text.latex.unicode',
'examples.directory',
'savefig.frameon', # deprecated in MPL 3.1, to be removed in 3.3
'verbose.level', # deprecated in MPL 3.1, to be removed in 3.3
'verbose.fileo', # deprecated in MPL 3.1, to be removed in 3.3
'datapath', # deprecated in MPL 3.2.1, to be removed in 3.3
]
old_rcparams = {k: mpl.rcParams[k] for k in mpl.rcParams.keys()
if mpl_version < '3.0' or k not in deprecated}

old_rcparams = get_non_deprecated_rcparams()
try:
cls._rcParams = old_rcparams
yield
Expand Down
15 changes: 15 additions & 0 deletions holoviews/plotting/mpl/util.py
Expand Up @@ -62,6 +62,21 @@ def is_color(color):
's': lambda x: is_number(x) and (x >= 0)
}

def get_non_deprecated_rcparams():
deprecated_rcparams = [
'text.latex.unicode',
'examples.directory',
'savefig.frameon', # deprecated in MPL 3.1, to be removed in 3.3
'verbose.level', # deprecated in MPL 3.1, to be removed in 3.3
'verbose.fileo', # deprecated in MPL 3.1, to be removed in 3.3
'datapath', # deprecated in MPL 3.2.1, to be removed in 3.3
]
non_deprecated_rcparams = {
k: v for k, v in matplotlib.rcParams.items()
if mpl_version < '3.0' or k not in deprecated_rcparams
}
return non_deprecated_rcparams


def get_validator(style):
for k, v in validators.items():
Expand Down

0 comments on commit b5f3721

Please sign in to comment.