Skip to content

Commit

Permalink
MAINT: Drop pd.options.display.mpl_style
Browse files Browse the repository at this point in the history
Deprecated in 0.18.0

xref pandas-devgh-12190
  • Loading branch information
gfyoung committed Jun 24, 2017
1 parent 1265c27 commit 0167cf6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 48 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.21.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ Removal of prior version deprecations/changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- :func:`read_excel()` has dropped the ``has_index_names`` parameter (:issue:`10967`)
- The ``pd.options.display.mpl_style`` configuration has been dropped (:issue:`12190`)
- ``Categorical`` has dropped the ``.order()`` and ``.sort()`` methods in favor of ``.sort_values()`` (:issue:`12882`)


Expand Down
32 changes: 0 additions & 32 deletions pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
module is imported, register them here rather then in the module.
"""
import warnings

import pandas.core.config as cf
from pandas.core.config import (is_int, is_bool, is_text, is_instance_factory,
is_one_of_factory, get_default_val,
Expand Down Expand Up @@ -313,33 +311,6 @@ def use_numexpr_cb(key):
style_backup = dict()


def mpl_style_cb(key):
warnings.warn(pc_mpl_style_deprecation_warning, FutureWarning,
stacklevel=5)

import sys
from pandas.plotting._style import mpl_stylesheet
global style_backup

val = cf.get_option(key)

if 'matplotlib' not in sys.modules.keys():
if not val: # starting up, we get reset to None
return val
raise Exception("matplotlib has not been imported. aborting")

import matplotlib.pyplot as plt

if val == 'default':
style_backup = dict([(k, plt.rcParams[k]) for k in mpl_stylesheet])
plt.rcParams.update(mpl_stylesheet)
elif not val:
if style_backup:
plt.rcParams.update(style_backup)

return val


def table_schema_cb(key):
from pandas.io.formats.printing import _enable_data_resource_formatter
_enable_data_resource_formatter(cf.get_option(key))
Expand Down Expand Up @@ -382,9 +353,6 @@ def table_schema_cb(key):
validator=is_one_of_factory([True, False, 'truncate']))
cf.register_option('chop_threshold', None, pc_chop_threshold_doc)
cf.register_option('max_seq_items', 100, pc_max_seq_items)
cf.register_option('mpl_style', None, pc_mpl_style_doc,
validator=is_one_of_factory([None, False, 'default']),
cb=mpl_style_cb)
cf.register_option('height', 60, pc_height_doc,
validator=is_instance_factory([type(None), int]))
cf.register_option('width', 80, pc_width_doc,
Expand Down
16 changes: 0 additions & 16 deletions pandas/tests/plotting/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import pandas.util.testing as tm
from pandas.util.testing import slow

from pandas.core.config import set_option

import numpy as np
from numpy.random import rand, randn

Expand Down Expand Up @@ -2682,20 +2680,6 @@ def test_df_grid_settings(self):
DataFrame({'a': [1, 2, 3], 'b': [2, 3, 4]}),
plotting._core._dataframe_kinds, kws={'x': 'a', 'y': 'b'})

def test_option_mpl_style(self):
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
set_option('display.mpl_style', 'default')
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
set_option('display.mpl_style', None)
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
set_option('display.mpl_style', False)

with pytest.raises(ValueError):
set_option('display.mpl_style', 'default2')

def test_invalid_colormap(self):
df = DataFrame(randn(3, 2), columns=['A', 'B'])

Expand Down

0 comments on commit 0167cf6

Please sign in to comment.