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

Skip to content

Commit a9a1abf

Browse files
committed
use setdefault method
1 parent f49904c commit a9a1abf

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4319,14 +4319,17 @@ def do_patch(xs, ys, **kwargs):
43194319
do_box = do_patch if patch_artist else do_plot
43204320
boxes.append(do_box(box_x, box_y, **box_kw))
43214321
# draw the whiskers
4322-
whiskers.append(do_plot(whis_x, whislo_y, **whisker_kw, label="_nolegend_"))
4323-
whiskers.append(do_plot(whis_x, whishi_y, **whisker_kw, label="_nolegend_"))
4322+
whisker_kw.setdefault('label', '_nolegend_')
4323+
whiskers.append(do_plot(whis_x, whislo_y, **whisker_kw))
4324+
whiskers.append(do_plot(whis_x, whishi_y, **whisker_kw))
43244325
# maybe draw the caps
43254326
if showcaps:
4326-
caps.append(do_plot(cap_x, cap_lo, **cap_kw, label="_nolegend_"))
4327-
caps.append(do_plot(cap_x, cap_hi, **cap_kw, label="_nolegend_"))
4327+
cap_kw.setdefault('label', '_nolegend_')
4328+
caps.append(do_plot(cap_x, cap_lo, **cap_kw))
4329+
caps.append(do_plot(cap_x, cap_hi, **cap_kw))
43284330
# draw the medians
4329-
medians.append(do_plot(med_x, med_y, **median_kw, label="_nolegend_"))
4331+
median_kw.setdefault('label', '_nolegend_')
4332+
medians.append(do_plot(med_x, med_y, **median_kw))
43304333
# maybe draw the means
43314334
if showmeans:
43324335
if meanline:
@@ -4338,9 +4341,10 @@ def do_patch(xs, ys, **kwargs):
43384341
means.append(do_plot([pos], [stats['mean']], **mean_kw))
43394342
# maybe draw the fliers
43404343
if showfliers:
4344+
flier_kw.setdefault('label', '_nolegend_')
43414345
flier_x = np.full(len(stats['fliers']), pos, dtype=np.float64)
43424346
flier_y = stats['fliers']
4343-
fliers.append(do_plot(flier_x, flier_y, **flier_kw, label="_nolegend_"))
4347+
fliers.append(do_plot(flier_x, flier_y, **flier_kw))
43444348

43454349
if manage_ticks:
43464350
axis_name = "x" if vert else "y"

0 commit comments

Comments
 (0)