From 4d2c994a5c62214b6728447dc137534410d00f53 Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Mon, 5 Sep 2016 15:50:21 +0100 Subject: [PATCH 01/13] [WIP] DOC: Updating docstring to numpy doc format for errorbar --- lib/matplotlib/axes/_axes.py | 96 +++++++++++++++++------------------- 1 file changed, 46 insertions(+), 50 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 0cba4d225e36..7eb01751f740 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2691,27 +2691,21 @@ def errorbar(self, x, y, yerr=None, xerr=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, capthick=None, **kwargs): - """ - Plot an errorbar graph. - - Call signature:: - - errorbar(x, y, yerr=None, xerr=None, - fmt='', ecolor=None, elinewidth=None, capsize=None, - barsabove=False, lolims=False, uplims=False, - xlolims=False, xuplims=False, errorevery=1, - capthick=None) - - Plot *x* versus *y* with error deltas in *yerr* and *xerr*. - Vertical errorbars are plotted if *yerr* is not *None*. - Horizontal errorbars are plotted if *xerr* is not *None*. + """Plot an errorbar graph. - *x*, *y*, *xerr*, and *yerr* can all be scalars, which plots a - single error bar at *x*, *y*. + Plot x versus y with error deltas in yerr and xerr. + Vertical errorbars are plotted if yerr is not None. + Horizontal errorbars are plotted if xerr is not None. - Optional keyword arguments: + x, y, xerr, and yerr can all be scalars, which plots a + single error bar at x, y. - *xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ] + Parameters + ---------- + x : scalar + y : scalar + + xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional, default: None If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn at +/-value relative to the data. @@ -2719,38 +2713,38 @@ def errorbar(self, x, y, yerr=None, xerr=None, If a sequence of shape 2xN, errorbars are drawn at -row1 and +row2 relative to the data. - *fmt*: [ '' | 'none' | plot format string ] - The plot format symbol. If *fmt* is 'none' (case-insensitive), + fmt : plot format string, optional, default: None + The plot format symbol. If fmt is 'none' (case-insensitive), only the errorbars are plotted. This is used for adding errorbars to a bar plot, for example. Default is '', an empty plot format string; properties are then identical to the defaults for :meth:`plot`. - *ecolor*: [ *None* | mpl color ] + ecolor : mpl color, optional, default: None A matplotlib color arg which gives the color the errorbar lines; - if *None*, use the color of the line connecting the markers. + if None, use the color of the line connecting the markers. - *elinewidth*: scalar - The linewidth of the errorbar lines. If *None*, use the linewidth. + elinewidth: scalar, optional, default: None + The linewidth of the errorbar lines. If None, use the linewidth. - *capsize*: scalar - The length of the error bar caps in points; if *None*, it will + capsize: scalar, optional, default: None + The length of the error bar caps in points; if None, it will take the value from ``errorbar.capsize`` :data:`rcParam`. - *capthick*: scalar - An alias kwarg to *markeredgewidth* (a.k.a. - *mew*). This + capthick: scalar, optional, default: None + An alias kwarg to markeredgewidth (a.k.a. - mew). This setting is a more sensible name for the property that controls the thickness of the error bar cap in points. For - backwards compatibility, if *mew* or *markeredgewidth* are given, - then they will over-ride *capthick*. This may change in future + backwards compatibility, if mew or markeredgewidth are given, + then they will over-ride capthick. This may change in future releases. - *barsabove*: [ *True* | *False* ] - if *True*, will plot the errorbars above the plot + barsabove: bool, optional, default: False + if True , will plot the errorbars above the plot symbols. Default is below. - *lolims* / *uplims* / *xlolims* / *xuplims*: [ *False* | *True* ] + lolims / uplims / xlolims / xuplims: bool, optional, default:None These arguments can be used to indicate that a value gives only upper/lower limits. In that case a caret symbol is used to indicate this. lims-arguments may be of the same @@ -2758,11 +2752,23 @@ def errorbar(self, x, y, yerr=None, xerr=None, axes, :meth:`set_xlim` or :meth:`set_ylim` must be called before :meth:`errorbar`. - *errorevery*: positive integer + errorevery: positive integer, optional, default:1 subsamples the errorbars. e.g., if errorevery=5, errorbars for every 5-th datapoint will be plotted. The data plot itself still shows all data points. + Returns + ------- + plotline: :class:`~matplotlib.lines.Line2D` instance + x, y plot markers and/or line + caplines: + list of error bar cap :class:`~matplotlib.lines.Line2D` instances + barlinecols: + list of :class:`~matplotlib.collections.LineCollection` instances for + the horizontal and vertical error ranges. + + Other Parameters + ---------------- All other keyword arguments are passed on to the plot command for the markers. For example, this code makes big red squares with thick green edges:: @@ -2771,29 +2777,19 @@ def errorbar(self, x, y, yerr=None, xerr=None, errorbar(x, y, yerr, marker='s', mfc='red', mec='green', ms=20, mew=4) - where *mfc*, *mec*, *ms* and *mew* are aliases for the longer - property names, *markerfacecolor*, *markeredgecolor*, *markersize* - and *markeredgewidth*. + where mfc, mec, ms and mew are aliases for the longer + property names, markerfacecolor, markeredgecolor, markersize + and markeredgewidth. valid kwargs for the marker properties are %(Line2D)s - Returns (*plotline*, *caplines*, *barlinecols*): - - *plotline*: :class:`~matplotlib.lines.Line2D` instance - *x*, *y* plot markers and/or line - - *caplines*: list of error bar cap - :class:`~matplotlib.lines.Line2D` instances - *barlinecols*: list of - :class:`~matplotlib.collections.LineCollection` instances for - the horizontal and vertical error ranges. - - **Example:** + Example + ------- .. plot:: mpl_examples/statistics/errorbar_demo.py - + """ kwargs = cbook.normalize_kwargs(kwargs, _alias_map) kwargs.setdefault('zorder', 2) From 5ecdb2efce65d83fb1e7cbe3eb963af6b05f73ef Mon Sep 17 00:00:00 2001 From: Seraphim Alvanides Date: Tue, 6 Sep 2016 19:27:44 +0100 Subject: [PATCH 02/13] [WIP] DOC: Fixed issues with whitespaces --- lib/matplotlib/axes/_axes.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 7eb01751f740..caf52a883a00 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2691,7 +2691,8 @@ def errorbar(self, x, y, yerr=None, xerr=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, capthick=None, **kwargs): - """Plot an errorbar graph. + """ + Plot an errorbar graph. Plot x versus y with error deltas in yerr and xerr. Vertical errorbars are plotted if yerr is not None. @@ -2702,13 +2703,13 @@ def errorbar(self, x, y, yerr=None, xerr=None, Parameters ---------- - x : scalar + x : scalar y : scalar - - xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional, default: None + + xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn at +/-value relative - to the data. + to the data. Default is None. If a sequence of shape 2xN, errorbars are drawn at -row1 and +row2 relative to the data. @@ -2759,11 +2760,11 @@ def errorbar(self, x, y, yerr=None, xerr=None, Returns ------- - plotline: :class:`~matplotlib.lines.Line2D` instance + plotline : :class:`~matplotlib.lines.Line2D` instance x, y plot markers and/or line - caplines: + caplines : list of error bar cap :class:`~matplotlib.lines.Line2D` instances - barlinecols: + barlinecols : list of :class:`~matplotlib.collections.LineCollection` instances for the horizontal and vertical error ranges. @@ -2789,7 +2790,6 @@ def errorbar(self, x, y, yerr=None, xerr=None, Example ------- .. plot:: mpl_examples/statistics/errorbar_demo.py - """ kwargs = cbook.normalize_kwargs(kwargs, _alias_map) kwargs.setdefault('zorder', 2) From d3d5ad0b631c299a57e8e4ffe037b7c2cded7642 Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Tue, 6 Sep 2016 22:57:32 +0100 Subject: [PATCH 03/13] [WIP] DOC: Removed 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 caf52a883a00..e87d0690ebb0 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2705,7 +2705,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, ---------- x : scalar y : scalar - + xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn at +/-value relative From 89c858634c47ba9c8a948eb5c1ebcf438d44a8cb Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Wed, 7 Sep 2016 18:22:04 +0100 Subject: [PATCH 04/13] [WIP] DOC: Shortened a too long line --- 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 e87d0690ebb0..8672e63bc6cb 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2706,7 +2706,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, x : scalar y : scalar - xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional + xerr/yerr : scalar/array-like, shape(n,1) or shape(2,n), optional If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn at +/-value relative to the data. Default is None. From 5a9ee002d35b01451be3fc013c3df5dd06070fc2 Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Thu, 8 Sep 2016 07:49:20 +0100 Subject: [PATCH 05/13] [WIP] DOC: Shortened line which was too long --- 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 8672e63bc6cb..f33077af7344 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2706,7 +2706,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, x : scalar y : scalar - xerr/yerr : scalar/array-like, shape(n,1) or shape(2,n), optional + xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional If a scalar number, len(N) array-like object, or an Nx1 array-like object, errorbars are drawn at +/-value relative to the data. Default is None. @@ -2765,8 +2765,8 @@ def errorbar(self, x, y, yerr=None, xerr=None, caplines : list of error bar cap :class:`~matplotlib.lines.Line2D` instances barlinecols : - list of :class:`~matplotlib.collections.LineCollection` instances for - the horizontal and vertical error ranges. + list of :class:`~matplotlib.collections.LineCollection` instances + for the horizontal and vertical error ranges. Other Parameters ---------------- From 6ab965eb315d0c73089a71d606acc3cc5324ff31 Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Thu, 8 Sep 2016 07:59:40 +0100 Subject: [PATCH 06/13] Removed 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 f33077af7344..e739b27acc51 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2765,7 +2765,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, caplines : list of error bar cap :class:`~matplotlib.lines.Line2D` instances barlinecols : - list of :class:`~matplotlib.collections.LineCollection` instances + list of :class:`~matplotlib.collections.LineCollection` instances for the horizontal and vertical error ranges. Other Parameters From 835fec6360e31e627e2d6bcfd758778bc4c5988a Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Thu, 8 Sep 2016 08:32:56 +0100 Subject: [PATCH 07/13] [WIP] DOC: Trying to fix intendation problems --- lib/matplotlib/axes/_axes.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index e739b27acc51..e33e5dbff232 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2774,9 +2774,8 @@ def errorbar(self, x, y, yerr=None, xerr=None, markers. For example, this code makes big red squares with thick green edges:: - x,y,yerr = rand(3,10) - errorbar(x, y, yerr, marker='s', - mfc='red', mec='green', ms=20, mew=4) + x,y,yerr = rand(3,10) + errorbar(x, y, yerr, marker='s', mfc='red', mec='green', ms=20, mew=4) where mfc, mec, ms and mew are aliases for the longer property names, markerfacecolor, markeredgecolor, markersize From d06853b5464546a20ef143944cf5d03277d2297c Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Thu, 8 Sep 2016 13:55:38 +0100 Subject: [PATCH 08/13] [WIP] DOC: Fixed typo --- 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 e33e5dbff232..2c69697aff92 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2786,7 +2786,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, %(Line2D)s - Example + Examples ------- .. plot:: mpl_examples/statistics/errorbar_demo.py """ From 96b05e95941e5d6b864d2b684230950c60d8ed53 Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Thu, 8 Sep 2016 23:49:06 +0100 Subject: [PATCH 09/13] DOC: Fixing intendation and small formatting problems --- lib/matplotlib/axes/_axes.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 2c69697aff92..6ca3776ad995 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2770,24 +2770,23 @@ def errorbar(self, x, y, yerr=None, xerr=None, Other Parameters ---------------- - All other keyword arguments are passed on to the plot command for the - markers. For example, this code makes big red squares with - thick green edges:: + kwargs : All other keyword arguments are passed on to the plot command for the + markers. For example, this code makes big red squares with + thick green edges:: - x,y,yerr = rand(3,10) - errorbar(x, y, yerr, marker='s', mfc='red', mec='green', ms=20, mew=4) + x,y,yerr = rand(3,10) + errorbar(x, y, yerr, marker='s', mfc='red', mec='green', ms=20, mew=4) - where mfc, mec, ms and mew are aliases for the longer - property names, markerfacecolor, markeredgecolor, markersize - and markeredgewidth. + where mfc, mec, ms and mew are aliases for the longer + property names, markerfacecolor, markeredgecolor, markersize + and markeredgewidth. - valid kwargs for the marker properties are - - %(Line2D)s + valid kwargs for the marker properties are + %(Line2D)s Examples - ------- + -------- .. plot:: mpl_examples/statistics/errorbar_demo.py """ kwargs = cbook.normalize_kwargs(kwargs, _alias_map) From f2f76894c00288d28b6f76d5a266d7653287042a Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Fri, 9 Sep 2016 00:55:04 +0100 Subject: [PATCH 10/13] DOC: Shortened too long lines --- lib/matplotlib/axes/_axes.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 6ca3776ad995..e6ab7adfa623 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2770,12 +2770,13 @@ def errorbar(self, x, y, yerr=None, xerr=None, Other Parameters ---------------- - kwargs : All other keyword arguments are passed on to the plot command for the - markers. For example, this code makes big red squares with - thick green edges:: + kwargs : All other keyword arguments are passed on to the plot + command for the markers. For example, this code makes big red + squares with thick green edges:: x,y,yerr = rand(3,10) - errorbar(x, y, yerr, marker='s', mfc='red', mec='green', ms=20, mew=4) + errorbar(x, y, yerr, marker='s', mfc='red', + mec='green', ms=20, mew=4) where mfc, mec, ms and mew are aliases for the longer property names, markerfacecolor, markeredgecolor, markersize From 8ae6f9453662939fb4b62a37b7381316fc298222 Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Fri, 9 Sep 2016 01:35:33 +0100 Subject: [PATCH 11/13] DOC: Removed trailling whitespace --- 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 e6ab7adfa623..66476f9665fc 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2770,12 +2770,12 @@ def errorbar(self, x, y, yerr=None, xerr=None, Other Parameters ---------------- - kwargs : All other keyword arguments are passed on to the plot - command for the markers. For example, this code makes big red + kwargs : All other keyword arguments are passed on to the plot + command for the markers. For example, this code makes big red squares with thick green edges:: x,y,yerr = rand(3,10) - errorbar(x, y, yerr, marker='s', mfc='red', + errorbar(x, y, yerr, marker='s', mfc='red', mec='green', ms=20, mew=4) where mfc, mec, ms and mew are aliases for the longer From 98f4ac1ff3963b39b875936f8f5ac2782dfc06db Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Sat, 10 Sep 2016 09:01:48 -0700 Subject: [PATCH 12/13] DOC minor fixes on the documentation of errorbar --- lib/matplotlib/axes/_axes.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 66476f9665fc..18586d608636 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2725,15 +2725,15 @@ def errorbar(self, x, y, yerr=None, xerr=None, A matplotlib color arg which gives the color the errorbar lines; if None, use the color of the line connecting the markers. - elinewidth: scalar, optional, default: None + elinewidth : scalar, optional, default: None The linewidth of the errorbar lines. If None, use the linewidth. - capsize: scalar, optional, default: None + capsize : scalar, optional, default: None The length of the error bar caps in points; if None, it will take the value from ``errorbar.capsize`` :data:`rcParam`. - capthick: scalar, optional, default: None + capthick : scalar, optional, default: None An alias kwarg to markeredgewidth (a.k.a. - mew). This setting is a more sensible name for the property that controls the thickness of the error bar cap in points. For @@ -2741,11 +2741,11 @@ def errorbar(self, x, y, yerr=None, xerr=None, then they will over-ride capthick. This may change in future releases. - barsabove: bool, optional, default: False + barsabove : bool, optional, default: False if True , will plot the errorbars above the plot symbols. Default is below. - lolims / uplims / xlolims / xuplims: bool, optional, default:None + lolims / uplims / xlolims / xuplims : bool, optional, default:None These arguments can be used to indicate that a value gives only upper/lower limits. In that case a caret symbol is used to indicate this. lims-arguments may be of the same @@ -2753,7 +2753,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, axes, :meth:`set_xlim` or :meth:`set_ylim` must be called before :meth:`errorbar`. - errorevery: positive integer, optional, default:1 + errorevery : positive integer, optional, default:1 subsamples the errorbars. e.g., if errorevery=5, errorbars for every 5-th datapoint will be plotted. The data plot itself still shows all data points. @@ -2762,11 +2762,10 @@ def errorbar(self, x, y, yerr=None, xerr=None, ------- plotline : :class:`~matplotlib.lines.Line2D` instance x, y plot markers and/or line - caplines : - list of error bar cap :class:`~matplotlib.lines.Line2D` instances - barlinecols : - list of :class:`~matplotlib.collections.LineCollection` instances - for the horizontal and vertical error ranges. + caplines : list of :class:`~matplotlib.lines.Line2D` instances + error bar cap + barlinecols : list of :class:`~matplotlib.collections.LineCollection` instances + horizontal and vertical error ranges. Other Parameters ---------------- From bec46f0b2d1d729bc4352964b7e78832bc722cba Mon Sep 17 00:00:00 2001 From: Benedikt Daurer Date: Sun, 11 Sep 2016 19:10:28 +0100 Subject: [PATCH 13/13] DOC: Shortened line to match pep8 --- 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 18586d608636..f155600fbcf8 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2764,7 +2764,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, x, y plot markers and/or line caplines : list of :class:`~matplotlib.lines.Line2D` instances error bar cap - barlinecols : list of :class:`~matplotlib.collections.LineCollection` instances + barlinecols : list of :class:`~matplotlib.collections.LineCollection` horizontal and vertical error ranges. Other Parameters