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

Skip to content

Commit 63cbb60

Browse files
authored
Merge pull request #16287 from anntzer/rcmark
Improve markup for rcParams in docs.
2 parents 47cfa35 + a9db3e1 commit 63cbb60

File tree

11 files changed

+26
-86
lines changed

11 files changed

+26
-86
lines changed

doc/devel/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ begin with ``"test_"`` and then within those files for functions beginning with
109109
``"test"`` or classes beginning with ``"Test"``.
110110

111111
Some tests have internal side effects that need to be cleaned up after their
112-
execution (such as created figures or modified rc params). The pytest fixture
112+
execution (such as created figures or modified `.rcParams`). The pytest fixture
113113
:func:`~matplotlib.testing.conftest.mpl_test_settings` will automatically clean
114114
these up; there is no need to do anything further.
115115

examples/color/color_cycler.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

examples/misc/customize_rc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
============
55
66
I'm not trying to make a good looking figure here, but just to show
7-
some examples of customizing rc params on the fly
7+
some examples of customizing `.rcParams` on the fly.
88
99
If you like to work interactively, and need to create different sets
1010
of defaults for figures (e.g., one set of defaults for publication, one
@@ -25,8 +25,8 @@ def set_pub():
2525
>>> plot([1, 2, 3])
2626
>>> savefig('myfig')
2727
>>> rcdefaults() # restore the defaults
28-
2928
"""
29+
3030
import matplotlib.pyplot as plt
3131

3232
plt.subplot(311)

examples/style_sheets/grayscale.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
=====================
55
66
This example demonstrates the "grayscale" style sheet, which changes all colors
7-
that are defined as rc parameters to grayscale. Note, however, that not all
8-
plot elements default to colors defined by an rc parameter.
9-
7+
that are defined as `.rcParams` to grayscale. Note, however, that not all
8+
plot elements respect `.rcParams`.
109
"""
10+
1111
import numpy as np
1212
import matplotlib.pyplot as plt
1313

lib/matplotlib/__init__.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -873,15 +873,15 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
873873

874874
def rc(group, **kwargs):
875875
"""
876-
Set the current rc params. *group* is the grouping for the rc, e.g.,
876+
Set the current `.rcParams`. *group* is the grouping for the rc, e.g.,
877877
for ``lines.linewidth`` the group is ``lines``, for
878878
``axes.facecolor``, the group is ``axes``, and so on. Group may
879879
also be a list or tuple of group names, e.g., (*xtick*, *ytick*).
880880
*kwargs* is a dictionary attribute name/value pairs, e.g.,::
881881
882882
rc('lines', linewidth=2, color='r')
883883
884-
sets the current rc params and is equivalent to::
884+
sets the current `.rcParams` and is equivalent to::
885885
886886
rcParams['lines.linewidth'] = 2
887887
rcParams['lines.color'] = 'r'
@@ -915,7 +915,7 @@ def rc(group, **kwargs):
915915
916916
This enables you to easily switch between several configurations. Use
917917
``matplotlib.style.use('default')`` or :func:`~matplotlib.rcdefaults` to
918-
restore the default rc params after changes.
918+
restore the default `.rcParams` after changes.
919919
920920
Notes
921921
-----
@@ -949,15 +949,16 @@ def rc(group, **kwargs):
949949

950950
def rcdefaults():
951951
"""
952-
Restore the rc params from Matplotlib's internal default style.
952+
Restore the `.rcParams` from Matplotlib's internal default style.
953953
954-
Style-blacklisted rc params (defined in
954+
Style-blacklisted `.rcParams` (defined in
955955
`matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
956956
957957
See Also
958958
--------
959959
rc_file_defaults
960-
Restore the rc params from the rc file originally loaded by Matplotlib.
960+
Restore the `.rcParams` from the rc file originally loaded by
961+
Matplotlib.
961962
matplotlib.style.use
962963
Use a specific style file. Call ``style.use('default')`` to restore
963964
the default style.
@@ -973,9 +974,9 @@ def rcdefaults():
973974

974975
def rc_file_defaults():
975976
"""
976-
Restore the rc params from the original rc file loaded by Matplotlib.
977+
Restore the `.rcParams` from the original rc file loaded by Matplotlib.
977978
978-
Style-blacklisted rc params (defined in
979+
Style-blacklisted `.rcParams` (defined in
979980
`matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
980981
"""
981982
# Deprecation warnings were already handled when creating rcParamsOrig, no
@@ -988,9 +989,9 @@ def rc_file_defaults():
988989

989990
def rc_file(fname, *, use_default_template=True):
990991
"""
991-
Update rc params from file.
992+
Update `.rcParams` from file.
992993
993-
Style-blacklisted rc params (defined in
994+
Style-blacklisted `.rcParams` (defined in
994995
`matplotlib.style.core.STYLE_BLACKLIST`) are not updated.
995996
996997
Parameters

lib/matplotlib/animation.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,8 @@ def func(current_frame: int, total_frames: int) -> Any
10311031
construct a `.MovieWriter` instance and can only be passed if
10321032
*writer* is a string. If they are passed as non-*None* and *writer*
10331033
is a `.MovieWriter`, a `RuntimeError` will be raised.
1034-
10351034
"""
1036-
# If the writer is None, use the rc param to find the name of the one
1037-
# to use
1035+
10381036
if writer is None:
10391037
writer = mpl.rcParams['animation.writer']
10401038
elif (not isinstance(writer, str) and
@@ -1263,8 +1261,8 @@ def to_html5_video(self, embed_limit=None):
12631261
Convert the animation to an HTML5 ``<video>`` tag.
12641262
12651263
This saves the animation as an h264 video, encoded in base64
1266-
directly into the HTML5 video tag. This respects the rc parameters
1267-
for the writer as well as the bitrate. This also makes use of the
1264+
directly into the HTML5 video tag. This respects :rc:`animation.writer`
1265+
and :rc:`animation.bitrate`. This also makes use of the
12681266
``interval`` to control the speed, and uses the ``repeat``
12691267
parameter to decide whether to loop.
12701268

lib/matplotlib/axes/_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def text(self, x, y, s, fontdict=None, **kwargs):
706706
707707
fontdict : dict, default: None
708708
A dictionary to override the default text properties. If fontdict
709-
is None, the defaults are determined by your rc parameters.
709+
is None, the defaults are determined by `.rcParams`.
710710
711711
Returns
712712
-------

lib/matplotlib/backends/backend_pgf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class LatexManager:
186186
"""
187187
The LatexManager opens an instance of the LaTeX application for
188188
determining the metrics of text elements. The LaTeX environment can be
189-
modified by setting fonts and/or a custom preamble in the rc parameters.
189+
modified by setting fonts and/or a custom preamble in `.rcParams`.
190190
"""
191191
_unclean_instances = weakref.WeakSet()
192192

lib/matplotlib/figure.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,9 +1831,8 @@ def text(self, x, y, s, fontdict=None, **kwargs):
18311831
18321832
fontdict : dict, optional
18331833
A dictionary to override the default text properties. If not given,
1834-
the defaults are determined by your rc parameters. Properties
1835-
passed as *kwargs* override the corresponding ones given in
1836-
*fontdict*.
1834+
the defaults are determined by `.rcParams`. Properties passed as
1835+
*kwargs* override the corresponding ones given in *fontdict*.
18371836
18381837
Other Parameters
18391838
----------------

tutorials/intermediate/color_cycle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
This example demonstrates two different APIs:
1515
16-
1. Setting the default rc parameter specifying the property cycle.
16+
1. Setting the rc parameter specifying the default property cycle.
1717
This affects all subsequent axes (but not axes already created).
1818
2. Setting the property cycle for a single pair of axes.
1919

tutorials/introductory/usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def my_plotter(ax, data1, data2, param_dict):
732732
# -----------------------------------
733733
#
734734
# If you are using the Agg backend (see :ref:`what-is-a-backend`),
735-
# then you can make use of the ``agg.path.chunksize`` rc parameter.
735+
# then you can make use of :rc:`agg.path.chunksize`
736736
# This allows you to specify a chunk size, and any lines with
737737
# greater than that many vertices will be split into multiple
738738
# lines, each of which has no more than ``agg.path.chunksize``

0 commit comments

Comments
 (0)