Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8cd97bf + fd687a9 commit 24bcabbCopy full SHA for 24bcabb
2 files changed
lib/matplotlib/__init__.py
@@ -995,17 +995,18 @@ def rc(group, **kwargs):
995
996
The following aliases are available to save typing for interactive users:
997
998
- ===== =================
+ ====== =================
999
Alias Property
1000
1001
'lw' 'linewidth'
1002
'ls' 'linestyle'
1003
'c' 'color'
1004
'fc' 'facecolor'
1005
'ec' 'edgecolor'
1006
'mew' 'markeredgewidth'
1007
'aa' 'antialiased'
1008
+ 'sans' 'sans-serif'
1009
1010
1011
Thus you could abbreviate the above call as::
1012
@@ -1039,6 +1040,7 @@ def rc(group, **kwargs):
1039
1040
'ec': 'edgecolor',
1041
'mew': 'markeredgewidth',
1042
'aa': 'antialiased',
1043
+ 'sans': 'sans-serif',
1044
}
1045
1046
if isinstance(group, str):
lib/matplotlib/tests/test_rcparams.py
@@ -654,3 +654,21 @@ def test_rcparams_path_sketch_from_file(tmp_path, value):
654
rc_path.write_text(f"path.sketch: {value}")
655
with mpl.rc_context(fname=rc_path):
656
assert mpl.rcParams["path.sketch"] == (1, 2, 3)
657
+
658
659
+@pytest.mark.parametrize('group, option, alias, value', [
660
+ ('lines', 'linewidth', 'lw', 3),
661
+ ('lines', 'linestyle', 'ls', 'dashed'),
662
+ ('lines', 'color', 'c', 'white'),
663
+ ('axes', 'facecolor', 'fc', 'black'),
664
+ ('figure', 'edgecolor', 'ec', 'magenta'),
665
+ ('lines', 'markeredgewidth', 'mew', 1.5),
666
+ ('patch', 'antialiased', 'aa', False),
667
+ ('font', 'sans-serif', 'sans', ["Verdana"])
668
+])
669
+def test_rc_aliases(group, option, alias, value):
670
+ rc_kwargs = {alias: value,}
671
+ mpl.rc(group, **rc_kwargs)
672
673
+ rcParams_key = f"{group}.{option}"
674
+ assert mpl.rcParams[rcParams_key] == value
0 commit comments