Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 788c28d

Browse filesBrowse files
authored
Merge pull request #13596 from anntzer/bxp-normalize-props
Normalize properties passed to bxp().
2 parents be0e033 + ef1567f commit 788c28d
Copy full SHA for 788c28d

File tree

Expand file treeCollapse file tree

2 files changed

+24
-16
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+24
-16
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+17-9Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3945,12 +3945,13 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
39453945

39463946
zdelta = 0.1
39473947

3948-
def with_rcdefaults(subkey, explicit, zdelta=0):
3948+
def line_props_with_rcdefaults(subkey, explicit, zdelta=0):
39493949
d = {k.split('.')[-1]: v for k, v in rcParams.items()
39503950
if k.startswith(f'boxplot.{subkey}')}
39513951
d['zorder'] = zorder + zdelta
39523952
if explicit is not None:
3953-
d.update(explicit)
3953+
d.update(
3954+
cbook.normalize_kwargs(explicit, mlines.Line2D._alias_map))
39543955
return d
39553956

39563957
# box properties
@@ -3964,14 +3965,21 @@ def with_rcdefaults(subkey, explicit, zdelta=0):
39643965
zorder=zorder,
39653966
)
39663967
if boxprops is not None:
3967-
final_boxprops.update(boxprops)
3968+
final_boxprops.update(
3969+
cbook.normalize_kwargs(
3970+
boxprops, mpatches.PathPatch._alias_map))
39683971
else:
3969-
final_boxprops = with_rcdefaults('boxprops', boxprops)
3970-
final_whiskerprops = with_rcdefaults('whiskerprops', whiskerprops)
3971-
final_capprops = with_rcdefaults('capprops', capprops)
3972-
final_flierprops = with_rcdefaults('flierprops', flierprops)
3973-
final_medianprops = with_rcdefaults('medianprops', medianprops, zdelta)
3974-
final_meanprops = with_rcdefaults('meanprops', meanprops, zdelta)
3972+
final_boxprops = line_props_with_rcdefaults('boxprops', boxprops)
3973+
final_whiskerprops = line_props_with_rcdefaults(
3974+
'whiskerprops', whiskerprops)
3975+
final_capprops = line_props_with_rcdefaults(
3976+
'capprops', capprops)
3977+
final_flierprops = line_props_with_rcdefaults(
3978+
'flierprops', flierprops)
3979+
final_medianprops = line_props_with_rcdefaults(
3980+
'medianprops', medianprops, zdelta)
3981+
final_meanprops = line_props_with_rcdefaults(
3982+
'meanprops', meanprops, zdelta)
39753983
removed_prop = 'marker' if meanline else 'linestyle'
39763984
# Only remove the property if it's not set explicitly as a parameter.
39773985
if meanprops is None or removed_prop not in meanprops:

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ def test_bxp_patchartist():
22952295
def test_bxp_custompatchartist():
22962296
_bxp_test_helper(bxp_kwargs=dict(
22972297
patch_artist=True,
2298-
boxprops=dict(facecolor='yellow', edgecolor='green', linestyle=':')))
2298+
boxprops=dict(facecolor='yellow', edgecolor='green', ls=':')))
22992299

23002300

23012301
@image_comparison(baseline_images=['bxp_customoutlier'],
@@ -2304,7 +2304,7 @@ def test_bxp_custompatchartist():
23042304
style='default')
23052305
def test_bxp_customoutlier():
23062306
_bxp_test_helper(bxp_kwargs=dict(
2307-
flierprops=dict(linestyle='none', marker='d', markerfacecolor='g')))
2307+
flierprops=dict(linestyle='none', marker='d', mfc='g')))
23082308

23092309

23102310
@image_comparison(baseline_images=['bxp_withmean_custompoint'],
@@ -2314,7 +2314,7 @@ def test_bxp_customoutlier():
23142314
def test_bxp_showcustommean():
23152315
_bxp_test_helper(bxp_kwargs=dict(
23162316
showmeans=True,
2317-
meanprops=dict(linestyle='none', marker='d', markerfacecolor='green'),
2317+
meanprops=dict(linestyle='none', marker='d', mfc='green'),
23182318
))
23192319

23202320

@@ -2324,7 +2324,7 @@ def test_bxp_showcustommean():
23242324
style='default')
23252325
def test_bxp_custombox():
23262326
_bxp_test_helper(bxp_kwargs=dict(
2327-
boxprops=dict(linestyle='--', color='b', linewidth=3)))
2327+
boxprops=dict(linestyle='--', color='b', lw=3)))
23282328

23292329

23302330
@image_comparison(baseline_images=['bxp_custommedian'],
@@ -2333,7 +2333,7 @@ def test_bxp_custombox():
23332333
style='default')
23342334
def test_bxp_custommedian():
23352335
_bxp_test_helper(bxp_kwargs=dict(
2336-
medianprops=dict(linestyle='--', color='b', linewidth=3)))
2336+
medianprops=dict(linestyle='--', color='b', lw=3)))
23372337

23382338

23392339
@image_comparison(baseline_images=['bxp_customcap'],
@@ -2342,7 +2342,7 @@ def test_bxp_custommedian():
23422342
style='default')
23432343
def test_bxp_customcap():
23442344
_bxp_test_helper(bxp_kwargs=dict(
2345-
capprops=dict(linestyle='--', color='g', linewidth=3)))
2345+
capprops=dict(linestyle='--', color='g', lw=3)))
23462346

23472347

23482348
@image_comparison(baseline_images=['bxp_customwhisker'],
@@ -2351,7 +2351,7 @@ def test_bxp_customcap():
23512351
style='default')
23522352
def test_bxp_customwhisker():
23532353
_bxp_test_helper(bxp_kwargs=dict(
2354-
whiskerprops=dict(linestyle='-', color='m', linewidth=3)))
2354+
whiskerprops=dict(linestyle='-', color='m', lw=3)))
23552355

23562356

23572357
@image_comparison(baseline_images=['bxp_withnotch'],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.