Skip to content

MAINT: Drop pd.options.display.mpl_style #16761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`)
- ``Index`` has dropped the ``.sym_diff()`` method in favor of ``.symmetric_difference()`` (:issue:`12591`)
- ``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