From 07044794d5b126d2dfe074c6a2e0b7e59d04b4c4 Mon Sep 17 00:00:00 2001 From: klaragerlei Date: Mon, 5 Sep 2016 16:19:52 +0100 Subject: [PATCH 1/6] DOC Updated plot_date documentation to NumPy/SciPy style --- lib/matplotlib/axes/_axes.py | 71 ++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 32 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 3d2d52b04474..3f523821a6c6 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1414,59 +1414,66 @@ def plot(self, *args, **kwargs): def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, **kwargs): """ - Plot with data with dates. + A plot with data that contains dates. - Call signature:: - - plot_date(x, y, fmt='bo', tz=None, xdate=True, - ydate=False, **kwargs) - - Similar to the :func:`~matplotlib.pyplot.plot` command, except + Similar to the func : matplotlib.pyplot.plot command, except the *x* or *y* (or both) data is considered to be dates, and the axis is labeled accordingly. *x* and/or *y* can be a sequence of dates represented as float days since 0001-01-01 UTC. - Keyword arguments: + Note if you are using custom date tickers and formatters, it + may be necessary to set the formatters/locators after the call + to meth : plot_date since meth : plot_date will set the + default tick locator to + class : matplotlib.dates.AutoDateLocator (if the tick + locator is not already set to a + class : matplotlib.dates.DateLocator instance) and the + default tick formatter to + class : matplotlib.dates.AutoDateFormatter (if the tick + formatter is not already set to a + class : matplotlib.dates.DateFormatter instance). + - *fmt*: string - The plot format string. + Parameters + ---------- + fmt : string + The plot format string. - *tz*: [ *None* | timezone string | :class:`tzinfo` instance] + tz : [ *None* | timezone string | :class:`tzinfo` instance] The time zone to use in labeling dates. If *None*, defaults to rc value. - *xdate*: [ *True* | *False* ] + xdate : boolean If *True*, the *x*-axis will be labeled with dates. - *ydate*: [ *False* | *True* ] + ydate : boolean If *True*, the *y*-axis will be labeled with dates. - Note if you are using custom date tickers and formatters, it - may be necessary to set the formatters/locators after the call - to :meth:`plot_date` since :meth:`plot_date` will set the - default tick locator to - :class:`matplotlib.dates.AutoDateLocator` (if the tick - locator is not already set to a - :class:`matplotlib.dates.DateLocator` instance) and the - default tick formatter to - :class:`matplotlib.dates.AutoDateFormatter` (if the tick - formatter is not already set to a - :class:`matplotlib.dates.DateFormatter` instance). - Valid kwargs are :class:`~matplotlib.lines.Line2D` properties: + Returns + ------- + lines - %(Line2D)s - .. seealso:: + See Also + -------- + mod : matplotlib.dates for helper functions + func : matplotlib.dates.date2num + func : matplotlib.dates.num2date + func : matplotlib.dates.drange for help on creating the required floating point dates + + + Other Parameters + ---------------- + kwargs : class : matplotlib.lines.Line2D properties : %(Line2D)s + - :mod:`~matplotlib.dates` for helper functions + Examples + -------- + .. plot:: mpl_examples/pylab_examples/date_demo1.py - :func:`~matplotlib.dates.date2num`, - :func:`~matplotlib.dates.num2date` and - :func:`~matplotlib.dates.drange` for help on creating the required - floating point dates. """ if not self._hold: From 92f8302edf4740455266ef90202dbc758baab199 Mon Sep 17 00:00:00 2001 From: klaragerlei Date: Tue, 6 Sep 2016 15:53:06 +0100 Subject: [PATCH 2/6] DOC changed tabs to spaces, formatted functions to old format --- lib/matplotlib/axes/_axes.py | 45 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 3f523821a6c6..f843ee109aff 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1414,9 +1414,9 @@ def plot(self, *args, **kwargs): def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, **kwargs): """ - A plot with data that contains dates. - - Similar to the func : matplotlib.pyplot.plot command, except + A plot with data that contains dates. + + Similar to the :func:~matplotlib.pyplot.plot command, except the *x* or *y* (or both) data is considered to be dates, and the axis is labeled accordingly. @@ -1436,10 +1436,10 @@ class : matplotlib.dates.AutoDateFormatter (if the tick class : matplotlib.dates.DateFormatter instance). - Parameters - ---------- - fmt : string - The plot format string. + Parameters + ---------- + fmt : string + The plot format string. tz : [ *None* | timezone string | :class:`tzinfo` instance] The time zone to use in labeling dates. If *None*, defaults to rc @@ -1452,27 +1452,28 @@ class : matplotlib.dates.DateFormatter instance). If *True*, the *y*-axis will be labeled with dates. - Returns - ------- - lines + Returns + ------- + lines - See Also - -------- - mod : matplotlib.dates for helper functions - func : matplotlib.dates.date2num - func : matplotlib.dates.num2date - func : matplotlib.dates.drange for help on creating the required floating point dates + See Also + -------- + mod : matplotlib.dates for helper functions + :func:~matplotlib.dates.date2num + :func:~matplotlib.dates.num2date + :func:~matplotlib.dates.drange for help on creating the required + floating point dates - Other Parameters - ---------------- + Other Parameters + ---------------- kwargs : class : matplotlib.lines.Line2D properties : %(Line2D)s - - Examples - -------- - .. plot:: mpl_examples/pylab_examples/date_demo1.py + + Examples + -------- + plot:: mpl_examples/pylab_examples/date_demo1.py """ From 692bb4a1c2e556114067a064cfc0dfb4bf1699ac Mon Sep 17 00:00:00 2001 From: Klara Gerlei Date: Wed, 7 Sep 2016 18:23:40 +0100 Subject: [PATCH 3/6] FIX Fixed missing backticks, removed extra spaces around colon. --- lib/matplotlib/axes/_axes.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index f843ee109aff..ad2278e763e2 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1416,7 +1416,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, """ A plot with data that contains dates. - Similar to the :func:~matplotlib.pyplot.plot command, except + Similar to the :func:`~matplotlib.pyplot.plot` command, except the *x* or *y* (or both) data is considered to be dates, and the axis is labeled accordingly. @@ -1425,15 +1425,15 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, Note if you are using custom date tickers and formatters, it may be necessary to set the formatters/locators after the call - to meth : plot_date since meth : plot_date will set the + to meth:`plot_date` since meth:`plot_date` will set the default tick locator to - class : matplotlib.dates.AutoDateLocator (if the tick + class:`matplotlib.dates.AutoDateLocator` (if the tick locator is not already set to a - class : matplotlib.dates.DateLocator instance) and the + class:`matplotlib.dates.DateLocator` instance) and the default tick formatter to - class : matplotlib.dates.AutoDateFormatter (if the tick + class:`matplotlib.dates.AutoDateFormatter` (if the tick formatter is not already set to a - class : matplotlib.dates.DateFormatter instance). + class:`matplotlib.dates.DateFormatter` instance). Parameters @@ -1468,7 +1468,8 @@ class : matplotlib.dates.DateFormatter instance). Other Parameters ---------------- - kwargs : class : matplotlib.lines.Line2D properties : %(Line2D)s + kwargs : class : matplotlib.lines.Line2D + properties : %(Line2D)s Examples From 16381cf66458fa0271b19109d3754d48e63ae15c Mon Sep 17 00:00:00 2001 From: Klara Gerlei Date: Wed, 7 Sep 2016 18:27:11 +0100 Subject: [PATCH 4/6] FIX Fixed more missing backticks --- lib/matplotlib/axes/_axes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ad2278e763e2..fc9494c2bcfe 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1460,9 +1460,9 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, See Also -------- mod : matplotlib.dates for helper functions - :func:~matplotlib.dates.date2num - :func:~matplotlib.dates.num2date - :func:~matplotlib.dates.drange for help on creating the required + :func:`~matplotlib.dates.date2num` + :func:`~matplotlib.dates.num2date` + :func:`~matplotlib.dates.drange` for help on creating the required floating point dates From 8968ad32c9241f3c1198080e2edb6f6e2ea02c21 Mon Sep 17 00:00:00 2001 From: klaragerlei Date: Fri, 9 Sep 2016 11:08:56 +0100 Subject: [PATCH 5/6] DOC deleted whitespace --- lib/matplotlib/axes/_axes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index fc9494c2bcfe..b4213b29932f 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1415,7 +1415,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, **kwargs): """ A plot with data that contains dates. - + Similar to the :func:`~matplotlib.pyplot.plot` command, except the *x* or *y* (or both) data is considered to be dates, and the axis is labeled accordingly. From e0b823915ecbd3f497f104bbad2d0b5426ceac8b Mon Sep 17 00:00:00 2001 From: Klara Gerlei Date: Sat, 10 Sep 2016 06:29:27 -0700 Subject: [PATCH 6/6] FIX See also in plot_date is rendered properly --- lib/matplotlib/axes/_axes.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index b4213b29932f..b906e39e7d5e 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1459,23 +1459,17 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, See Also -------- - mod : matplotlib.dates for helper functions - :func:`~matplotlib.dates.date2num` - :func:`~matplotlib.dates.num2date` - :func:`~matplotlib.dates.drange` for help on creating the required - floating point dates + matplotlib.dates : helper functions on dates + matplotlib.dates.date2num : how to convert dates to num + matplotlib.dates.num2date : how to convert num to dates + matplotlib.dates.drange : how floating point dates Other Parameters ---------------- - kwargs : class : matplotlib.lines.Line2D + kwargs : :class:`matplotlib.lines.Line2D` properties : %(Line2D)s - - Examples - -------- - plot:: mpl_examples/pylab_examples/date_demo1.py - """ if not self._hold: