From 2405f9562d014e604cfa3dbe46af4dc90e99a555 Mon Sep 17 00:00:00 2001 From: Jody Klymak Date: Fri, 7 Sep 2018 16:29:20 -0700 Subject: [PATCH 1/2] DOC: make Line2D docstring definition easier to find --- doc/devel/documenting_mpl.rst | 2 +- lib/matplotlib/axes/_axes.py | 24 ++++++++++++------------ lib/matplotlib/axes/_base.py | 2 +- lib/matplotlib/lines.py | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/devel/documenting_mpl.rst b/doc/devel/documenting_mpl.rst index 42f5bd89cb88..7602e45d2530 100644 --- a/doc/devel/documenting_mpl.rst +++ b/doc/devel/documenting_mpl.rst @@ -614,7 +614,7 @@ Then in any function accepting `~.Line2D` pass-through ``kwargs``, e.g., Some stuff omitted The kwargs are Line2D properties: - %(Line2D)s + %(_Line2D_docstr)s kwargs scalex and scaley, if defined, are passed on to autoscale_view to determine whether the x and y axes are diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 429ab58b70e2..947cfb55f4a8 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -759,7 +759,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs): Valid kwargs are :class:`~matplotlib.lines.Line2D` properties, with the exception of 'transform': - %(Line2D)s + %(_Line2D_docstr)s See also -------- @@ -829,7 +829,7 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs): Valid kwargs are :class:`~matplotlib.lines.Line2D` properties, with the exception of 'transform': - %(Line2D)s + %(_Line2D_docstr)s Examples -------- @@ -1498,7 +1498,7 @@ def plot(self, *args, scalex=True, scaley=True, **kwargs): Here is a list of available `.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s Returns ------- @@ -1650,7 +1650,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s See Also @@ -3015,7 +3015,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, Valid kwargs for the marker properties are `.Lines2D` properties: - %(Line2D)s + %(_Line2D_docstr)s Notes ----- @@ -6938,7 +6938,7 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s See Also -------- @@ -7063,7 +7063,7 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s See Also -------- @@ -7161,7 +7161,7 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s See Also -------- @@ -7258,7 +7258,7 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s See Also -------- @@ -7340,7 +7340,7 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s See Also -------- @@ -7419,7 +7419,7 @@ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s References ---------- @@ -7681,7 +7681,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None, For the marker style, you can pass any `.Line2D` property except for *linestyle*: - %(Line2D)s + %(_Line2D_docstr)s """ if marker is None and markersize is None and hasattr(Z, 'tocoo'): marker = 's' diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 1065effbad06..91c9db08e94b 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2716,7 +2716,7 @@ def grid(self, b=None, which='major', axis='both', **kwargs): Valid *kwargs* are - %(Line2D)s + %(_Line2D_docstr)s Notes ----- diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 8ac215d34baf..879c7de90600 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -300,7 +300,7 @@ def __init__(self, xdata, ydata, The kwargs are :class:`~matplotlib.lines.Line2D` properties: - %(Line2D)s + %(_Line2D_docstr)s See :meth:`set_linestyle` for a description of the line styles, :meth:`set_marker` for a description of the markers, and @@ -1531,7 +1531,7 @@ def onpick(self, event): drawStyles = Line2D.drawStyles fillStyles = MarkerStyle.fillstyles -docstring.interpd.update(Line2D=artist.kwdoc(Line2D)) +docstring.interpd.update(_Line2D_docstr=artist.kwdoc(Line2D)) # You can not set the docstring of an instancemethod, # but you can on the underlying function. Go figure. From e7069a71f1a4c040595b47f02b69eafdbf6114cc Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 7 Sep 2018 22:32:45 -0700 Subject: [PATCH 2/2] DOC: fix Line2D indentation in docstrings --- lib/matplotlib/axes/_axes.py | 22 +++++++++++----------- lib/matplotlib/axes/_base.py | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 947cfb55f4a8..8469526bed08 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -759,7 +759,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs): Valid kwargs are :class:`~matplotlib.lines.Line2D` properties, with the exception of 'transform': - %(_Line2D_docstr)s + %(_Line2D_docstr)s See also -------- @@ -829,7 +829,7 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs): Valid kwargs are :class:`~matplotlib.lines.Line2D` properties, with the exception of 'transform': - %(_Line2D_docstr)s + %(_Line2D_docstr)s Examples -------- @@ -1498,7 +1498,7 @@ def plot(self, *args, scalex=True, scaley=True, **kwargs): Here is a list of available `.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s Returns ------- @@ -1650,7 +1650,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s See Also @@ -3015,7 +3015,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, Valid kwargs for the marker properties are `.Lines2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s Notes ----- @@ -6938,7 +6938,7 @@ def psd(self, x, NFFT=None, Fs=None, Fc=None, detrend=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s See Also -------- @@ -7063,7 +7063,7 @@ def csd(self, x, y, NFFT=None, Fs=None, Fc=None, detrend=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s See Also -------- @@ -7161,7 +7161,7 @@ def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s See Also -------- @@ -7258,7 +7258,7 @@ def angle_spectrum(self, x, Fs=None, Fc=None, window=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s See Also -------- @@ -7340,7 +7340,7 @@ def phase_spectrum(self, x, Fs=None, Fc=None, window=None, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s See Also -------- @@ -7419,7 +7419,7 @@ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none, Keyword arguments control the :class:`~matplotlib.lines.Line2D` properties: - %(_Line2D_docstr)s + %(_Line2D_docstr)s References ---------- diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 91c9db08e94b..e304a780cbc8 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2716,7 +2716,7 @@ def grid(self, b=None, which='major', axis='both', **kwargs): Valid *kwargs* are - %(_Line2D_docstr)s + %(_Line2D_docstr)s Notes -----