From 5019e57215aeb8d407acb1f88fb4047c8c120630 Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 6 Apr 2025 21:04:20 +0000 Subject: [PATCH 01/16] Adding elinestyle property to errorbar and test case --- lib/matplotlib/axes/_axes.py | 15 ++++++++++++++- lib/matplotlib/axes/_axes.pyi | 1 + lib/matplotlib/tests/test_axes.py | 24 +++++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index b46cbce39c58..45b62fc81bc5 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3458,7 +3458,7 @@ def _errorevery_to_mask(x, errorevery): label_namer="y") @_docstring.interpd def errorbar(self, x, y, yerr=None, xerr=None, - fmt='', ecolor=None, elinewidth=None, capsize=None, + fmt='', ecolor=None, elinewidth=None, elinestyle=None, capsize=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, capthick=None, **kwargs): @@ -3508,6 +3508,12 @@ def errorbar(self, x, y, yerr=None, xerr=None, The linewidth of the errorbar lines. If None, the linewidth of the current style is used. + elinestyle : str or tuple, default:None + str or tuple or list thereof + Valid values for individual linestyles include {'-', '--', '-.', + ':', '', (offset, on-off-seq)}. See `.Line2D.set_linestyle` for a + complete description. + capsize : float, default: :rc:`errorbar.capsize` The length of the error bar caps in points. @@ -3822,6 +3828,13 @@ def apply_mask(arrays, mask): self._request_autoscale_view() caplines = caplines['x'] + caplines['y'] + + if(elinestyle is not None): + if(xerr is not None and yerr is not None): + barcols[-2].set_linestyle(elinestyle) + barcols[-1].set_linestyle(elinestyle) + + errorbar_container = ErrorbarContainer( (data_line, tuple(caplines), tuple(barcols)), has_xerr=(xerr is not None), has_yerr=(yerr is not None), diff --git a/lib/matplotlib/axes/_axes.pyi b/lib/matplotlib/axes/_axes.pyi index 6d9a5d14db72..a8bf35aef681 100644 --- a/lib/matplotlib/axes/_axes.pyi +++ b/lib/matplotlib/axes/_axes.pyi @@ -315,6 +315,7 @@ class Axes(_AxesBase): *, ecolor: ColorType | None = ..., elinewidth: float | None = ..., + elinestyle: str | None=..., capsize: float | None = ..., barsabove: bool = ..., lolims: bool | ArrayLike = ..., diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 70d1671cafa3..5a42f74bc5b8 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4525,7 +4525,29 @@ def test_errorbar_every(fig_test, fig_ref): def test_errorbar_linewidth_type(elinewidth): plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth) - +def test_errorbar_linestyle_type(): + eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-') + assert eb[-1][0].get_linestyle(),'-' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='--') + assert eb[-1][0].get_linestyle(),'--' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-.') + assert eb[-1][0].get_linestyle(),'-.' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle=':') + assert eb[-1][0].get_linestyle(),':' + + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle='-') + assert eb[-1][0].get_linestyle(),'-' + assert eb[-1][1].get_linestyle(),'-' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3],yerr=[1, 2, 3], elinestyle='--') + assert eb[-1][0].get_linestyle(),'--' + assert eb[-1][1].get_linestyle(),'--' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3],yerr=[1, 2, 3], elinestyle='-.') + assert eb[-1][0].get_linestyle(),'-.' + assert eb[-1][1].get_linestyle(),'-.' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3],yerr=[1, 2, 3], elinestyle=':') + assert eb[-1][0].get_linestyle(),':' + assert eb[-1][1].get_linestyle(),':' + @check_figures_equal() def test_errorbar_nan(fig_test, fig_ref): ax = fig_test.add_subplot() From cf79005278143e1ed569117a1242e8e69d558e6f Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 6 Apr 2025 21:56:48 +0000 Subject: [PATCH 02/16] whitespaces in testcase --- lib/matplotlib/tests/test_axes.py | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 5a42f74bc5b8..73b10b2025a3 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4527,27 +4527,27 @@ def test_errorbar_linewidth_type(elinewidth): def test_errorbar_linestyle_type(): eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-') - assert eb[-1][0].get_linestyle(),'-' + assert eb[-1][0].get_linestyle(), '-' eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='--') - assert eb[-1][0].get_linestyle(),'--' + assert eb[-1][0].get_linestyle(), '--' eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-.') - assert eb[-1][0].get_linestyle(),'-.' + assert eb[-1][0].get_linestyle(), '-.' eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle=':') - assert eb[-1][0].get_linestyle(),':' + assert eb[-1][0].get_linestyle(), ':' eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle='-') - assert eb[-1][0].get_linestyle(),'-' - assert eb[-1][1].get_linestyle(),'-' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3],yerr=[1, 2, 3], elinestyle='--') - assert eb[-1][0].get_linestyle(),'--' - assert eb[-1][1].get_linestyle(),'--' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3],yerr=[1, 2, 3], elinestyle='-.') - assert eb[-1][0].get_linestyle(),'-.' - assert eb[-1][1].get_linestyle(),'-.' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3],yerr=[1, 2, 3], elinestyle=':') - assert eb[-1][0].get_linestyle(),':' - assert eb[-1][1].get_linestyle(),':' - + assert eb[-1][0].get_linestyle(), '-' + assert eb[-1][1].get_linestyle(), '-' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle='--') + assert eb[-1][0].get_linestyle(), '--' + assert eb[-1][1].get_linestyle(), '--' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle='-.') + assert eb[-1][0].get_linestyle(), '-.' + assert eb[-1][1].get_linestyle(), '-.' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle=':') + assert eb[-1][0].get_linestyle(), ':' + assert eb[-1][1].get_linestyle(), ':' + @check_figures_equal() def test_errorbar_nan(fig_test, fig_ref): ax = fig_test.add_subplot() From 3f139f2714144233d98c03999ccd3d9c34d4ff2e Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Tue, 8 Apr 2025 17:55:47 -0400 Subject: [PATCH 03/16] Update lib/matplotlib/axes/_axes.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- 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 45b62fc81bc5..b238ce05ce2f 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3508,9 +3508,9 @@ def errorbar(self, x, y, yerr=None, xerr=None, The linewidth of the errorbar lines. If None, the linewidth of the current style is used. - elinestyle : str or tuple, default:None - str or tuple or list thereof - Valid values for individual linestyles include {'-', '--', '-.', + elinestyle : str or tuple, default: 'solid' + The linestyle of the errorbar lines. + Valid values for linestyles include {'-', '--', '-.', ':', '', (offset, on-off-seq)}. See `.Line2D.set_linestyle` for a complete description. From 596bcded7e0e251774b149c1e3e741d426b78116 Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 20:52:44 +0000 Subject: [PATCH 04/16] Update set eb_line_style and fix formatting issues --- lib/matplotlib/axes/_axes.py | 21 ++++++++++----------- lib/matplotlib/axes/_axes.pyi | 2 +- lib/matplotlib/pyplot.py | 12 +----------- lib/matplotlib/tests/test_axes.py | 23 ++++------------------- 4 files changed, 16 insertions(+), 42 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index b238ce05ce2f..8cdde45f861a 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3453,14 +3453,15 @@ def _errorevery_to_mask(x, errorevery): everymask[errorevery] = True return everymask - @_api.make_keyword_only("3.10", "ecolor") + @_api.make_keyword_only("3.10", "elinestyle") @_preprocess_data(replace_names=["x", "y", "xerr", "yerr"], label_namer="y") @_docstring.interpd def errorbar(self, x, y, yerr=None, xerr=None, - fmt='', ecolor=None, elinewidth=None, elinestyle=None, capsize=None, + fmt='', ecolor=None, elinewidth=None, capsize=None, barsabove=False, lolims=False, uplims=False, xlolims=False, xuplims=False, errorevery=1, capthick=None, + elinestyle=None, **kwargs): """ Plot y versus x as lines and/or markers with attached errorbars. @@ -3715,6 +3716,12 @@ def _upcast_err(err): if key in kwargs: eb_lines_style[key] = kwargs[key] + if elinestyle is not None: + eb_lines_style['style'] = elinestyle + #if xerr is not None and yerr is not None: + #barcols[-2].set_linestyle(elinestyle) + #barcols[-1].set_linestyle(elinestyle) + # Make the style dict for caps (the "hats"). eb_cap_style = {**base_style, 'linestyle': 'none'} capsize = mpl._val_or_rc(capsize, "errorbar.capsize") @@ -3824,17 +3831,9 @@ def apply_mask(arrays, mask): else: for axis in caplines: for l in caplines[axis]: - self.add_line(l) - + self.add_line(l) self._request_autoscale_view() caplines = caplines['x'] + caplines['y'] - - if(elinestyle is not None): - if(xerr is not None and yerr is not None): - barcols[-2].set_linestyle(elinestyle) - barcols[-1].set_linestyle(elinestyle) - - errorbar_container = ErrorbarContainer( (data_line, tuple(caplines), tuple(barcols)), has_xerr=(xerr is not None), has_yerr=(yerr is not None), diff --git a/lib/matplotlib/axes/_axes.pyi b/lib/matplotlib/axes/_axes.pyi index a8bf35aef681..d92921ccc3e7 100644 --- a/lib/matplotlib/axes/_axes.pyi +++ b/lib/matplotlib/axes/_axes.pyi @@ -315,7 +315,7 @@ class Axes(_AxesBase): *, ecolor: ColorType | None = ..., elinewidth: float | None = ..., - elinestyle: str | None=..., + elinestyle: LineStyleType | None=..., capsize: float | None = ..., barsabove: bool = ..., lolims: bool | ArrayLike = ..., diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 999b8e42120e..b792df23d47d 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -3041,7 +3041,7 @@ def bar_label( *, fmt: str | Callable[[float], str] = "%g", label_type: Literal["center", "edge"] = "edge", - padding: float | ArrayLike = 0, + padding: float = 0, **kwargs, ) -> list[Annotation]: return gca().bar_label( @@ -4117,9 +4117,6 @@ def streamplot( integration_direction="both", broken_streamlines=True, *, - integration_max_step_scale=1.0, - integration_max_error_scale=1.0, - num_arrows=1, data=None, ): __ret = gca().streamplot( @@ -4141,9 +4138,6 @@ def streamplot( maxlength=maxlength, integration_direction=integration_direction, broken_streamlines=broken_streamlines, - integration_max_step_scale=integration_max_step_scale, - integration_max_error_scale=integration_max_error_scale, - num_arrows=num_arrows, **({"data": data} if data is not None else {}), ) sci(__ret.lines) @@ -4291,8 +4285,6 @@ def violinplot( | Callable[[GaussianKDE], float] | None = None, side: Literal["both", "low", "high"] = "both", - facecolor: Sequence[ColorType] | ColorType | None = None, - linecolor: Sequence[ColorType] | ColorType | None = None, *, data=None, ) -> dict[str, Collection]: @@ -4309,8 +4301,6 @@ def violinplot( points=points, bw_method=bw_method, side=side, - facecolor=facecolor, - linecolor=linecolor, **({"data": data} if data is not None else {}), ) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 73b10b2025a3..0865b5ecc2c1 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4527,26 +4527,11 @@ def test_errorbar_linewidth_type(elinewidth): def test_errorbar_linestyle_type(): eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-') - assert eb[-1][0].get_linestyle(), '-' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='--') - assert eb[-1][0].get_linestyle(), '--' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-.') - assert eb[-1][0].get_linestyle(), '-.' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle=':') - assert eb[-1][0].get_linestyle(), ':' - - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle='-') - assert eb[-1][0].get_linestyle(), '-' - assert eb[-1][1].get_linestyle(), '-' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle='--') - assert eb[-1][0].get_linestyle(), '--' - assert eb[-1][1].get_linestyle(), '--' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle='-.') - assert eb[-1][0].get_linestyle(), '-.' - assert eb[-1][1].get_linestyle(), '-.' + assert eb[-1][0].get_linestyle() == '-' + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle=':') - assert eb[-1][0].get_linestyle(), ':' - assert eb[-1][1].get_linestyle(), ':' + assert eb[-1][0].get_linestyle() == ':' + assert eb[-1][1].get_linestyle() == ':' @check_figures_equal() def test_errorbar_nan(fig_test, fig_ref): From 73137f6cbe6f2e6f511b2c2161e72b7e3c8f67c7 Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 21:02:35 +0000 Subject: [PATCH 05/16] Remove extra line from test_axes --- lib/matplotlib/tests/test_axes.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 0865b5ecc2c1..7913ccac5e0d 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4528,7 +4528,6 @@ def test_errorbar_linewidth_type(elinewidth): def test_errorbar_linestyle_type(): eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-') assert eb[-1][0].get_linestyle() == '-' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle=':') assert eb[-1][0].get_linestyle() == ':' assert eb[-1][1].get_linestyle() == ':' From 005904325a390ed630affe7d0ffaa24aa9aa885a Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 21:06:21 +0000 Subject: [PATCH 06/16] Break line to reduce width in text_axes.py --- lib/matplotlib/tests/test_axes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 7913ccac5e0d..27299cec6e54 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4526,9 +4526,11 @@ def test_errorbar_linewidth_type(elinewidth): plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth) def test_errorbar_linestyle_type(): - eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-') + eb = plt.errorbar([1, 2, 3], [1, 2, 3], + yerr=[1, 2, 3], elinestyle='-') assert eb[-1][0].get_linestyle() == '-' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle=':') + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], + yerr=[1, 2, 3], elinestyle=':') assert eb[-1][0].get_linestyle() == ':' assert eb[-1][1].get_linestyle() == ':' From 2bdf70bb6f36e7c5eda39225813eaed7678bfacd Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 21:16:33 +0000 Subject: [PATCH 07/16] Remove trailing whitespaces from axes and test_axes.py --- lib/matplotlib/axes/_axes.py | 2 +- lib/matplotlib/tests/test_axes.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 8cdde45f861a..fd5292273088 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3831,7 +3831,7 @@ def apply_mask(arrays, mask): else: for axis in caplines: for l in caplines[axis]: - self.add_line(l) + self.add_line(l) self._request_autoscale_view() caplines = caplines['x'] + caplines['y'] errorbar_container = ErrorbarContainer( diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 27299cec6e54..7c80cbafe750 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4526,10 +4526,10 @@ def test_errorbar_linewidth_type(elinewidth): plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth) def test_errorbar_linestyle_type(): - eb = plt.errorbar([1, 2, 3], [1, 2, 3], + eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-') assert eb[-1][0].get_linestyle() == '-' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], + eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], yerr=[1, 2, 3], elinestyle=':') assert eb[-1][0].get_linestyle() == ':' assert eb[-1][1].get_linestyle() == ':' From e4127757aa50e8b900342a7414358fd4842b671e Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 21:31:55 +0000 Subject: [PATCH 08/16] Move elinestyle to the end of the list --- 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 fd5292273088..3b2a1df04334 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3453,15 +3453,14 @@ def _errorevery_to_mask(x, errorevery): everymask[errorevery] = True return everymask - @_api.make_keyword_only("3.10", "elinestyle") + @_api.make_keyword_only("3.10", "ecolor") @_preprocess_data(replace_names=["x", "y", "xerr", "yerr"], label_namer="y") @_docstring.interpd def errorbar(self, 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, - elinestyle=None, + xlolims=False, xuplims=False, errorevery=1, capthick=None, elinestyle=None, **kwargs): """ Plot y versus x as lines and/or markers with attached errorbars. From a02930f213c236cca9aa4ee13803e326c1f982c9 Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 21:34:49 +0000 Subject: [PATCH 09/16] Shorten line length in axes.py --- lib/matplotlib/axes/_axes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 3b2a1df04334..7ff0fe15722f 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3460,7 +3460,8 @@ def _errorevery_to_mask(x, errorevery): def errorbar(self, 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, elinestyle=None, + xlolims=False, xuplims=False, errorevery=1, + capthick=None, elinestyle=None, **kwargs): """ Plot y versus x as lines and/or markers with attached errorbars. From 26a73b4640d2d8c3e3713f2b70599e28a1b49f1c Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 23:47:16 +0000 Subject: [PATCH 10/16] accessing the correct property 'linestyle' in eb_line_style --- 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 7ff0fe15722f..5e8bc34a5fc6 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3717,7 +3717,7 @@ def _upcast_err(err): eb_lines_style[key] = kwargs[key] if elinestyle is not None: - eb_lines_style['style'] = elinestyle + eb_lines_style['linestyle'] = elinestyle #if xerr is not None and yerr is not None: #barcols[-2].set_linestyle(elinestyle) #barcols[-1].set_linestyle(elinestyle) From 9d0dece6a1d9081e3c21ceb9dceb71a3afc2233e Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 13 Apr 2025 23:49:38 +0000 Subject: [PATCH 11/16] removing unused code --- lib/matplotlib/axes/_axes.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 5e8bc34a5fc6..cc70cc020957 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3718,9 +3718,6 @@ def _upcast_err(err): if elinestyle is not None: eb_lines_style['linestyle'] = elinestyle - #if xerr is not None and yerr is not None: - #barcols[-2].set_linestyle(elinestyle) - #barcols[-1].set_linestyle(elinestyle) # Make the style dict for caps (the "hats"). eb_cap_style = {**base_style, 'linestyle': 'none'} From 896678f45aac32b52f10fd90af01affa9e757c50 Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sun, 20 Apr 2025 18:54:49 -0400 Subject: [PATCH 12/16] Update lib/matplotlib/axes/_axes.pyi Co-authored-by: Elliott Sales de Andrade --- lib/matplotlib/axes/_axes.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.pyi b/lib/matplotlib/axes/_axes.pyi index d92921ccc3e7..766090e42ff7 100644 --- a/lib/matplotlib/axes/_axes.pyi +++ b/lib/matplotlib/axes/_axes.pyi @@ -315,7 +315,7 @@ class Axes(_AxesBase): *, ecolor: ColorType | None = ..., elinewidth: float | None = ..., - elinestyle: LineStyleType | None=..., + elinestyle: LineStyleType | None = ..., capsize: float | None = ..., barsabove: bool = ..., lolims: bool | ArrayLike = ..., From 2e49747548ea7a5ceebf5febb0cd0cf27bde509f Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sat, 26 Apr 2025 23:08:16 +0000 Subject: [PATCH 13/16] pyplot.py unwanted changes reverted --- lib/matplotlib/pyplot.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index b792df23d47d..a977a3a350cb 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -3041,7 +3041,7 @@ def bar_label( *, fmt: str | Callable[[float], str] = "%g", label_type: Literal["center", "edge"] = "edge", - padding: float = 0, + padding: float | ArrayLike = 0, **kwargs, ) -> list[Annotation]: return gca().bar_label( @@ -3281,6 +3281,7 @@ def errorbar( xuplims: bool | ArrayLike = False, errorevery: int | tuple[int, int] = 1, capthick: float | None = None, + elinestyle: LineStyleType | None = None, *, data=None, **kwargs, @@ -3301,6 +3302,7 @@ def errorbar( xuplims=xuplims, errorevery=errorevery, capthick=capthick, + elinestyle=elinestyle, **({"data": data} if data is not None else {}), **kwargs, ) @@ -4117,6 +4119,9 @@ def streamplot( integration_direction="both", broken_streamlines=True, *, + integration_max_step_scale=1.0, + integration_max_error_scale=1.0, + num_arrows=1, data=None, ): __ret = gca().streamplot( @@ -4138,6 +4143,9 @@ def streamplot( maxlength=maxlength, integration_direction=integration_direction, broken_streamlines=broken_streamlines, + integration_max_step_scale=integration_max_step_scale, + integration_max_error_scale=integration_max_error_scale, + num_arrows=num_arrows, **({"data": data} if data is not None else {}), ) sci(__ret.lines) @@ -4285,6 +4293,8 @@ def violinplot( | Callable[[GaussianKDE], float] | None = None, side: Literal["both", "low", "high"] = "both", + facecolor: Sequence[ColorType] | ColorType | None = None, + linecolor: Sequence[ColorType] | ColorType | None = None, *, data=None, ) -> dict[str, Collection]: @@ -4301,6 +4311,8 @@ def violinplot( points=points, bw_method=bw_method, side=side, + facecolor=facecolor, + linecolor=linecolor, **({"data": data} if data is not None else {}), ) From 44638f37c56ca9aaa972bbd575dc19819d46be7f Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Sat, 26 Apr 2025 20:23:50 -0400 Subject: [PATCH 14/16] Adding extra blank lines to fix style errors, and removing unnecessary asserts --- lib/matplotlib/tests/test_axes.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 17bd6793b0d7..172e133a1c03 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4525,14 +4525,12 @@ def test_errorbar_every(fig_test, fig_ref): def test_errorbar_linewidth_type(elinewidth): plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinewidth=elinewidth) + def test_errorbar_linestyle_type(): eb = plt.errorbar([1, 2, 3], [1, 2, 3], yerr=[1, 2, 3], elinestyle='-') - assert eb[-1][0].get_linestyle() == '-' - eb = plt.errorbar([1, 2, 3], [1, 2, 3], xerr=[1, 2, 3], - yerr=[1, 2, 3], elinestyle=':') - assert eb[-1][0].get_linestyle() == ':' - assert eb[-1][1].get_linestyle() == ':' + assert eb[-1][0].get_linestyle() == [(0,None)] + @check_figures_equal() def test_errorbar_nan(fig_test, fig_ref): From 0e36c506a6f986940a8615f732f88395fd929cc6 Mon Sep 17 00:00:00 2001 From: Hasan Rashid Date: Tue, 29 Apr 2025 03:54:03 -0400 Subject: [PATCH 15/16] Updating test_axes.py tp test for dashed lines instead of default --- lib/matplotlib/axes/_axes.py | 1 + lib/matplotlib/tests/test_axes.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 38744ce080e2..1b3159a17533 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -3835,6 +3835,7 @@ def apply_mask(arrays, mask): for axis in caplines: for l in caplines[axis]: self.add_line(l) + self._request_autoscale_view() caplines = caplines['x'] + caplines['y'] errorbar_container = ErrorbarContainer( diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index e5e47589bbd6..471a020b0c57 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4528,8 +4528,10 @@ def test_errorbar_linewidth_type(elinewidth): def test_errorbar_linestyle_type(): eb = plt.errorbar([1, 2, 3], [1, 2, 3], - yerr=[1, 2, 3], elinestyle='-') - assert eb[-1][0].get_linestyle() == [(0,None)] + yerr=[1, 2, 3], elinestyle='--') + errorlines = eb[-1][0] + errorlinestyle = errorlines.get_linestyle() + assert errorlinestyle == [(0.0,(6.0,6.0))] @check_figures_equal() From ff0370a99014847c0a86a6e5d97cc08e5e3ed0df Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Tue, 29 Apr 2025 13:48:13 +0200 Subject: [PATCH 16/16] Style fix --- lib/matplotlib/tests/test_axes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 471a020b0c57..f7aea2e6b1b1 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4531,7 +4531,7 @@ def test_errorbar_linestyle_type(): yerr=[1, 2, 3], elinestyle='--') errorlines = eb[-1][0] errorlinestyle = errorlines.get_linestyle() - assert errorlinestyle == [(0.0,(6.0,6.0))] + assert errorlinestyle == [(0, (6, 6))] @check_figures_equal()