Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa1ef74

Browse files
committed
Include STYLE_BLACKLIST in documentation
* Include `STYLE_BLACKLIST` in the documentation of `matplotlib.style.use` in alphabetical order. * Print list of rcParams in `matplotlib.RcParams` in alphabetical order. * Fix broken links to `.style.available` in `lib/matplotlib/style/core.py`.
1 parent 74f8161 commit fa1ef74

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/matplotlib/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@ def gen_candidates():
597597
_all_deprecated = {*_deprecated_map, *_deprecated_ignore_map}
598598

599599

600-
@docstring.Substitution("\n".join(map("- {}".format, rcsetup._validators)))
600+
@docstring.Substitution(
601+
"\n".join(map("- {}".format, sorted(rcsetup._validators, key=str.lower)))
602+
)
601603
class RcParams(MutableMapping, dict):
602604
"""
603605
A dictionary object including validation.

lib/matplotlib/style/core.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import warnings
2121

2222
import matplotlib as mpl
23-
from matplotlib import _api, rc_params_from_file, rcParamsDefault
23+
from matplotlib import _api, docstring, rc_params_from_file, rcParamsDefault
2424

2525
_log = logging.getLogger(__name__)
2626

@@ -65,6 +65,9 @@ def _apply_style(d, warn=True):
6565
mpl.rcParams.update(_remove_blacklisted_style_params(d, warn=warn))
6666

6767

68+
@docstring.Substitution(
69+
"\n".join(map("- {}".format, sorted(STYLE_BLACKLIST, key=str.lower)))
70+
)
6871
def use(style):
6972
"""
7073
Use Matplotlib style settings from a style specification.
@@ -84,7 +87,7 @@ def use(style):
8487
8588
+------+-------------------------------------------------------------+
8689
| str | The name of a style or a path/URL to a style file. For a |
87-
| | list of available style names, see `style.available`. |
90+
| | list of available style names, see `.style.available`. |
8891
+------+-------------------------------------------------------------+
8992
| dict | Dictionary with valid key/value pairs for |
9093
| | `matplotlib.rcParams`. |
@@ -95,6 +98,12 @@ def use(style):
9598
| | first to last in the list. |
9699
+------+-------------------------------------------------------------+
97100
101+
Notes
102+
-----
103+
The following `.rcParams` are not related to style and will be ignored if
104+
found in a style specification:
105+
106+
%s
98107
"""
99108
style_alias = {'mpl20': 'default',
100109
'mpl15': 'classic'}
@@ -139,7 +148,7 @@ def context(style, after_reset=False):
139148
140149
+------+-------------------------------------------------------------+
141150
| str | The name of a style or a path/URL to a style file. For a |
142-
| | list of available style names, see `style.available`. |
151+
| | list of available style names, see `.style.available`. |
143152
+------+-------------------------------------------------------------+
144153
| dict | Dictionary with valid key/value pairs for |
145154
| | `matplotlib.rcParams`. |

0 commit comments

Comments
 (0)