Skip to content

Replace "matplotlibrc" by "rcParams" in the docs where applicable. #10898

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 1 commit into from
Apr 1, 2018
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
20 changes: 4 additions & 16 deletions doc/matplotlibrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
backend : Agg

figure.figsize : 5.5, 4.5 # figure size in inches
savefig.dpi : 80 # figure dots per inch
docstring.hardcopy : True # set this when you want to generate hardcopy docstring

# these parameters are useful for packagers who want to build the docs
# w/o invoking file downloads for the sampledata (see
# matplotlib.cbook.get_sample_data. Unpack
# mpl_sampledata-VERSION.tar.gz and point examples.directory to it.
# You can use a relative path for examples.directory and it must be
# relative to this matplotlibrc file

#examples.download : False # False to bypass downloading mechanism
#examples.directory : /your/path/to/sample_data/ # directory to look in if download is false

backend : Agg
figure.figsize : 5.5, 4.5 # figure size in inches
savefig.dpi : 80 # figure dots per inch
docstring.hardcopy : True # set this when you want to generate hardcopy docstring
7 changes: 3 additions & 4 deletions examples/api/sankey_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@
# Notice:
#
# 1. Since the sum of the flows is nonzero, the width of the trunk isn't
# uniform. If verbose.level is helpful (in matplotlibrc), a message is
# given in the terminal window.
# 2. The second flow doesn't appear because its value is zero. Again, if
# verbose.level is helpful, a message is given in the terminal window.
# uniform. The matplotlib logging system logs this at the DEBUG level.
# 2. The second flow doesn't appear because its value is zero. Again, this is
# logged at the DEBUG level.


###############################################################################
Expand Down
10 changes: 6 additions & 4 deletions examples/api/unicode_minus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
Unicode minus
=============

You can use the proper typesetting Unicode minus (see
https://en.wikipedia.org/wiki/Plus_sign#Plus_sign) or the ASCII hyphen
for minus, which some people prefer. The matplotlibrc param
axes.unicode_minus controls the default behavior.
You can use the proper typesetting `Unicode minus`__ or the ASCII hyphen for
minus, which some people prefer. :rc:`axes.unicode_minus` controls the default
behavior.

__ https://en.wikipedia.org/wiki/Plus_and_minus_signs#Character_codes

The default is to use the Unicode minus.
"""

import numpy as np
import matplotlib
import matplotlib.pyplot as plt
Expand Down
3 changes: 2 additions & 1 deletion examples/ticks_and_spines/tick_xlabel_top.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
(default False) and :rc:`xtick.labelbottom` (default True) and
:rc:`xtick.bottom` (default True) to control where on the axes ticks and
their labels appear.
These properties can also be set in the ``.matplotlib/matplotlibrc``.

These properties can also be set in ``.matplotlib/matplotlibrc``.
"""

import matplotlib.pyplot as plt
import numpy as np

Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3369,8 +3369,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,

"""

# If defined in matplotlibrc, apply the value from rc file
# Overridden if argument is passed
# Missing arguments default to rcParams.
if whis is None:
whis = rcParams['boxplot.whiskers']
if bootstrap is None:
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2454,7 +2454,7 @@ def key_press_handler(event, canvas, toolbar=None):
if event.key is None:
return

# Load key-mappings from your matplotlibrc file.
# Load key-mappings from rcParams.
fullscreen_keys = rcParams['keymap.fullscreen']
home_keys = rcParams['keymap.home']
back_keys = rcParams['keymap.back']
Expand Down
11 changes: 5 additions & 6 deletions lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,10 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
Other Parameters
----------------
quality : int
The image quality, on a scale from 1 (worst) to
95 (best). The default is 95, if not given in the
matplotlibrc file in the savefig.jpeg_quality parameter.
Values above 95 should be avoided; 100 completely
disables the JPEG quantization stage.
The image quality, on a scale from 1 (worst) to 100 (best).
The default is :rc:`savefig.jpeg_quality`. Values above
95 should be avoided; 100 completely disables the JPEG
quantization stage.

optimize : bool
If present, indicates that the encoder should
Expand All @@ -543,7 +542,7 @@ def print_jpg(self, filename_or_obj, *args, **kwargs):
# handle any transparency
image = Image.frombuffer('RGBA', size, buf, 'raw', 'RGBA', 0, 1)
rgba = mcolors.to_rgba(rcParams['savefig.facecolor'])
color = tuple([int(x * 255.0) for x in rgba[:3]])
color = tuple([int(x * 255) for x in rgba[:3]])
background = Image.new('RGB', size, color)
background.paste(image, image)
options = {k: kwargs[k]
Expand Down
10 changes: 4 additions & 6 deletions lib/matplotlib/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -1743,19 +1743,17 @@ def _initialize_x_y(self, z):
contour-only keyword arguments:

*linewidths*: [ *None* | number | tuple of numbers ]
If *linewidths* is *None*, the default width in
``lines.linewidth`` in ``matplotlibrc`` is used.
If *None*, defaults to :rc:`lines.linewidth`.

If a number, all levels will be plotted with this linewidth.

If a tuple, different levels will be plotted with different
linewidths in the order specified.

*linestyles*: [ *None* | 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
If *linestyles* is *None*, the default is 'solid' unless
the lines are monochrome. In that case, negative
contours will take their linestyle from the ``matplotlibrc``
``contour.negative_linestyle`` setting.
If *linestyles* is *None*, the default is 'solid' unless the lines
are monochrome. In that case, negative contours will take their
linestyle from :rc:`contour.negative_linestyle` setting.

*linestyles* can also be an iterable of the above strings
specifying a set of linestyles to be used. If this
Expand Down
18 changes: 9 additions & 9 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1809,28 +1809,28 @@ def savefig(self, fname, **kwargs):

If *format* is *None* and *fname* is a string, the output
format is deduced from the extension of the filename. If
the filename has no extension, the value of the rc parameter
``savefig.format`` is used.
the filename has no extension, :rc:`savefig.format` is used.

If *fname* is not a string, remember to specify *format* to
ensure that the correct backend is used.

Other Parameters
----------------

dpi : [ *None* | scalar > 0 | 'figure']
The resolution in dots per inch. If *None* it will default to
the value ``savefig.dpi`` in the matplotlibrc file. If 'figure'
it will set the dpi to be the value of the figure.
dpi : [ *None* | scalar > 0 | 'figure' ]
The resolution in dots per inch. If *None*, defaults to
:rc:`savefig.dpi`. If 'figure', uses the figure's dpi value.

facecolor : color spec or None, optional
the facecolor of the figure; if None, defaults to savefig.facecolor
The facecolor of the figure; if *None*, defaults to
:rc:`savefig.facecolor`.

edgecolor : color spec or None, optional
the edgecolor of the figure; if None, defaults to savefig.edgecolor
The edgecolor of the figure; if *None*, defaults to
:rc:`savefig.edgecolor`

orientation : {'landscape', 'portrait'}
not supported on all backends; currently only on postscript output
Currently only supported by the postscript backend.

papertype : str
One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
Expand Down
8 changes: 4 additions & 4 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ class FontProperties(object):
The items may include a generic font family name, either
'serif', 'sans-serif', 'cursive', 'fantasy', or 'monospace'.
In that case, the actual font to be used will be looked up
from the associated rcParam in :file:`matplotlibrc`.
from the associated rcParam.

- style: Either 'normal', 'italic' or 'oblique'.

Expand All @@ -577,7 +577,7 @@ class FontProperties(object):
absolute font size, e.g., 12

The default font property for TrueType fonts (as specified in the
default :file:`matplotlibrc` file) is::
default rcParams) is::

sans-serif, normal, normal, normal, normal, scalable.

Expand All @@ -596,9 +596,9 @@ class FontProperties(object):
This support does not require fontconfig to be installed. We are merely
borrowing its pattern syntax for use here.

Note that matplotlib's internal font manager and fontconfig use a
Note that Matplotlib's internal font manager and fontconfig use a
different algorithm to lookup fonts, so the results of the same pattern
may be different in matplotlib than in other applications that use
may be different in Matplotlib than in other applications that use
fontconfig.
"""

Expand Down
3 changes: 1 addition & 2 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N
to properly clean up the memory.

rcParams defines the default values, which can be modified in the
matplotlibrc file

matplotlibrc file.
"""

if figsize is None:
Expand Down
7 changes: 1 addition & 6 deletions lib/matplotlib/texmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@
Z = texmanager.get_rgba(s, fontsize=12, dpi=80, rgb=(1,0,0))

To enable tex rendering of all text in your matplotlib figure, set
text.usetex in your matplotlibrc file or include these two lines in
your script::

from matplotlib import rc
rc('text', usetex=True)

:rc:`text.usetex` to True.
"""

import copy
Expand Down
9 changes: 4 additions & 5 deletions lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,11 +969,10 @@ def set_linespacing(self, spacing):

def set_family(self, fontname):
"""
Set the font family. May be either a single string, or a list
of strings in decreasing priority. Each string may be either
a real font name or a generic font class name. If the latter,
the specific font names will be looked up in the
:file:`matplotlibrc` file.
Set the font family. May be either a single string, or a list of
strings in decreasing priority. Each string may be either a real font
name or a generic font class name. If the latter, the specific font
names will be looked up in the corresponding rcParams.

ACCEPTS: [FONTNAME | 'serif' | 'sans-serif' | 'cursive' | 'fantasy' |
'monospace' ]
Expand Down
6 changes: 2 additions & 4 deletions lib/matplotlib/tri/tricontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,7 @@ def tricontour(ax, *args, **kwargs):
tricontour-only keyword arguments:

*linewidths*: [ *None* | number | tuple of numbers ]
If *linewidths* is *None*, the default width in
``lines.linewidth`` in ``matplotlibrc`` is used.
If *linewidths* is *None*, defaults to rc:`lines.linewidth`.

If a number, all levels will be plotted with this linewidth.

Expand All @@ -248,8 +247,7 @@ def tricontour(ax, *args, **kwargs):

If contour is using a monochrome colormap and the contour
level is less than 0, then the linestyle specified
in ``contour.negative_linestyle`` in ``matplotlibrc``
will be used.
in :rc:`contour.negative_linestyle` will be used.

tricontourf-only keyword arguments:

Expand Down