From d8d05ce90c0e9543f14f847d14db47ea20a56bef Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sun, 26 May 2019 20:02:57 +0200 Subject: [PATCH] Use raw docstrings --- lib/matplotlib/axes/_axes.py | 8 ++++---- lib/matplotlib/cbook/__init__.py | 4 ++-- lib/matplotlib/colors.py | 4 ++-- lib/matplotlib/docstring.py | 2 +- lib/matplotlib/markers.py | 2 +- lib/matplotlib/mathtext.py | 12 ++++++------ lib/matplotlib/mlab.py | 4 ++-- lib/matplotlib/rcsetup.py | 4 ++-- lib/matplotlib/text.py | 4 ++-- lib/matplotlib/ticker.py | 12 ++++++------ lib/matplotlib/widgets.py | 9 +++++---- lib/mpl_toolkits/axisartist/axislines.py | 2 +- 12 files changed, 34 insertions(+), 33 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 7da553de87db..235b6cd966d2 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -7114,7 +7114,7 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None, def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, return_line=None, **kwargs): - """ + r""" Plot the cross-spectral density. The cross spectral density :math:`P_{xy}` by Welch's average @@ -7181,7 +7181,7 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None, Notes ----- For plotting, the power is plotted as - :math:`10\\log_{10}(P_{xy})` for decibels, though `P_{xy}` itself + :math:`10 \log_{10}(P_{xy})` for decibels, though `P_{xy}` itself is returned. References @@ -7459,7 +7459,7 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None, def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, window=mlab.window_hanning, noverlap=0, pad_to=None, sides='default', scale_by_freq=None, **kwargs): - """ + r""" Plot the coherence between *x* and *y*. Plot the coherence between *x* and *y*. Coherence is the @@ -7467,7 +7467,7 @@ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, .. math:: - C_{xy} = \\frac{|P_{xy}|^2}{P_{xx}P_{yy}} + C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}} Parameters ---------- diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index b9e97d594909..fb0e2ed08faf 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -1026,7 +1026,7 @@ def _combine_masks(*args): def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None, autorange=False): - """ + r""" Returns list of dictionaries of statistics used to draw a series of box and whisker plots. The `Returns` section enumerates the required keys of the dictionary. Users can skip this function and @@ -1095,7 +1095,7 @@ def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None, .. math:: - \\mathrm{med} \\pm 1.57 \\times \\frac{\\mathrm{iqr}}{\\sqrt{N}} + \mathrm{med} \pm 1.57 \times \frac{\mathrm{iqr}}{\sqrt{N}} General approach from: McGill, R., Tukey, J.W., and Larsen, W.A. (1978) "Variations of diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 66fbd7de1c62..d5ab4c4da52b 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -2002,8 +2002,8 @@ def from_levels_and_colors(levels, colors, extend='neither'): Returns ------- - (cmap, norm) : tuple containing a :class:`Colormap` and a \ - :class:`Normalize` instance + cmap : `~matplotlib.colors.Normalize` + norm : `~matplotlib.colors.Colormap` """ colors_i0 = 0 colors_i1 = None diff --git a/lib/matplotlib/docstring.py b/lib/matplotlib/docstring.py index 5abd73e7d3d7..8ac6d8153f11 100644 --- a/lib/matplotlib/docstring.py +++ b/lib/matplotlib/docstring.py @@ -61,7 +61,7 @@ def from_params(cls, params): @cbook.deprecated("3.1") class Appender: - """ + r""" A function decorator that will append an addendum to the docstring of the target function. diff --git a/lib/matplotlib/markers.py b/lib/matplotlib/markers.py index 7bbd90e632f7..77415d22ba94 100644 --- a/lib/matplotlib/markers.py +++ b/lib/matplotlib/markers.py @@ -1,4 +1,4 @@ -""" +r""" This module contains functions to handle markers. Used by both the marker functionality of `~matplotlib.axes.Axes.plot` and `~matplotlib.axes.Axes.scatter`. diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index c64f29d7f996..a92a773fb8f9 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -412,7 +412,7 @@ def destroy(self): def get_kern(self, font1, fontclass1, sym1, fontsize1, font2, fontclass2, sym2, fontsize2, dpi): - """ + r""" Get the kerning distance for font between *sym1* and *sym2*. *fontX*: one of the TeX font names:: @@ -421,7 +421,7 @@ def get_kern(self, font1, fontclass1, sym1, fontsize1, *fontclassX*: TODO - *symX*: a symbol in raw TeX form. e.g., '1', 'x' or '\\sigma' + *symX*: a symbol in raw TeX form. e.g., '1', 'x' or '\sigma' *fontsizeX*: the fontsize in points @@ -430,14 +430,14 @@ def get_kern(self, font1, fontclass1, sym1, fontsize1, return 0. def get_metrics(self, font, font_class, sym, fontsize, dpi, math=True): - """ + r""" *font*: one of the TeX font names:: tt, it, rm, cal, sf, bf or default/regular (non-math) *font_class*: TODO - *sym*: a symbol in raw TeX form. e.g., '1', 'x' or '\\sigma' + *sym*: a symbol in raw TeX form. e.g., '1', 'x' or '\sigma' *fontsize*: font size in points @@ -1647,13 +1647,13 @@ def kern(self): # return 0.0 def hpack(self, w=0., m='additional'): - """ + r""" The main duty of :meth:`hpack` is to compute the dimensions of the resulting boxes, and to adjust the glue if one of those dimensions is pre-specified. The computed sizes normally enclose all of the material inside the new box; but some items may stick out if negative glue is used, if the box is - overfull, or if a ``\\vbox`` includes other boxes that have + overfull, or if a ``\vbox`` includes other boxes that have been shifted left. - *w*: specifies a width diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index dfc65b81ca8f..7fd39af4e0f4 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -1071,13 +1071,13 @@ def specgram(x, NFFT=None, Fs=None, detrend=None, window=None, @docstring.dedent_interpd def cohere(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0, pad_to=None, sides='default', scale_by_freq=None): - """ + r""" The coherence between *x* and *y*. Coherence is the normalized cross spectral density: .. math:: - C_{xy} = \\frac{|P_{xy}|^2}{P_{xx}P_{yy}} + C_{xy} = \frac{|P_{xy}|^2}{P_{xx}P_{yy}} Parameters ---------- diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 162b364bdbe5..f61fd5c6c434 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -730,10 +730,10 @@ def __call__(self, s): def validate_hatch(s): - """ + r""" Validate a hatch pattern. A hatch pattern string can have any sequence of the following - characters: ``\\ / | - + * . x o O``. + characters: ``\ / | - + * . x o O``. """ if not isinstance(s, str): diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index 00af1ca3b3f5..c054990b0368 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1137,10 +1137,10 @@ def set_verticalalignment(self, align): self.stale = True def set_text(self, s): - """ + r""" Set the text string *s*. - It may contain newlines (``\\n``) or math in LaTeX syntax. + It may contain newlines (``\n``) or math in LaTeX syntax. Parameters ---------- diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 337cda1a84f4..1fd873450abf 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -1220,7 +1220,7 @@ class EngFormatter(Formatter): def __init__(self, unit="", places=None, sep=" ", *, usetex=None, useMathText=None): - """ + r""" Parameters ---------- unit : str (default: "") @@ -1242,9 +1242,9 @@ def __init__(self, unit="", places=None, sep=" ", *, usetex=None, other useful options may be: * ``sep=""`` to append directly the prefix/unit to the value; - * ``sep="\\N{THIN SPACE}"`` (``U+2009``); - * ``sep="\\N{NARROW NO-BREAK SPACE}"`` (``U+202F``); - * ``sep="\\N{NO-BREAK SPACE}"`` (``U+00A0``). + * ``sep="\N{THIN SPACE}"`` (``U+2009``); + * ``sep="\N{NARROW NO-BREAK SPACE}"`` (``U+202F``); + * ``sep="\N{NO-BREAK SPACE}"`` (``U+00A0``). usetex : bool (default: None) To enable/disable the use of TeX's math mode for rendering the @@ -1441,11 +1441,11 @@ def convert_to_pct(self, x): @property def symbol(self): - """ + r""" The configured percent symbol as a string. If LaTeX is enabled via :rc:`text.usetex`, the special characters - ``{'#', '$', '%', '&', '~', '_', '^', '\\', '{', '}'}`` are + ``{'#', '$', '%', '&', '~', '_', '^', '\', '{', '}'}`` are automatically escaped in the string. """ symbol = self._symbol diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 25557dc7966b..1ffeced55f52 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -1724,10 +1724,11 @@ class SpanSelector(_SelectorWidget): If True, the span stays visible after the mouse is released button : int or list of ints - Determines which mouse buttons activate the span selector - 1 = left mouse button\n - 2 = center mouse button (scroll wheel)\n - 3 = right mouse button\n + Determines which mouse buttons activate the span selector: + + - 1: left mouse button + - 2: center mouse button (scroll wheel) + - 3: right mouse button Examples -------- diff --git a/lib/mpl_toolkits/axisartist/axislines.py b/lib/mpl_toolkits/axisartist/axislines.py index e4c9ec3e1738..b954cc1466a0 100644 --- a/lib/mpl_toolkits/axisartist/axislines.py +++ b/lib/mpl_toolkits/axisartist/axislines.py @@ -76,7 +76,7 @@ def get_label_pos(self, axes): return (x, y), trans - def get_label_offset_transform(self, \ + def get_label_offset_transform(self, axes, pad_points, fontprops, renderer, bboxes,