Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2be7e7f

Browse files
committed
Condensed setting values in lines_kw and plot_kw in the errorbar function
1 parent b76263c commit 2be7e7f

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,16 +2682,12 @@ def errorbar(self, x, y, yerr=None, xerr=None,
26822682
if elinewidth:
26832683
lines_kw['linewidth'] = elinewidth
26842684
else:
2685-
if 'linewidth' in kwargs:
2686-
lines_kw['linewidth'] = kwargs['linewidth']
2687-
if 'lw' in kwargs:
2688-
lines_kw['lw'] = kwargs['lw']
2689-
if 'transform' in kwargs:
2690-
lines_kw['transform'] = kwargs['transform']
2691-
if 'alpha' in kwargs:
2692-
lines_kw['alpha'] = kwargs['alpha']
2693-
if 'zorder' in kwargs:
2694-
lines_kw['zorder'] = kwargs['zorder']
2685+
for key in ('linewidth', 'lw'):
2686+
if key in kwargs:
2687+
lines_kw[key] = kwargs[key]
2688+
for key in ('transform', 'alpha', 'zorder'):
2689+
if key in kwargs:
2690+
lines_kw[key] = kwargs[key]
26952691

26962692
# arrays fine here, they are booleans and hence not units
26972693
if not iterable(lolims):
@@ -2739,16 +2735,9 @@ def xywhere(xs, ys, mask):
27392735
plot_kw['markeredgewidth'] = capthick
27402736
# For backwards-compat, allow explicit setting of
27412737
# 'mew' or 'markeredgewidth' to over-ride capthick.
2742-
if 'markeredgewidth' in kwargs:
2743-
plot_kw['markeredgewidth'] = kwargs['markeredgewidth']
2744-
if 'mew' in kwargs:
2745-
plot_kw['mew'] = kwargs['mew']
2746-
if 'transform' in kwargs:
2747-
plot_kw['transform'] = kwargs['transform']
2748-
if 'alpha' in kwargs:
2749-
plot_kw['alpha'] = kwargs['alpha']
2750-
if 'zorder' in kwargs:
2751-
plot_kw['zorder'] = kwargs['zorder']
2738+
for key in ('markeredgewidth', 'mew', 'transform', 'alpha', 'zorder'):
2739+
if key in kwargs:
2740+
plot_kw[key] = kwargs[key]
27522741

27532742
if xerr is not None:
27542743
if (iterable(xerr) and len(xerr) == 2 and

0 commit comments

Comments
 (0)