@@ -1390,63 +1390,63 @@ def test_collection_hatchcolor_inherit_logic():
1390
1390
from matplotlib .collections import PathCollection
1391
1391
path = mpath .Path .unit_rectangle ()
1392
1392
1393
- colors_1 = ['purple' , 'red' , 'green' , 'yellow' ]
1394
- colors_2 = ['orange' , 'cyan' , 'blue' , 'magenta' ]
1393
+ edgecolors = ['purple' , 'red' , 'green' , 'yellow' ]
1394
+ hatchcolors = ['orange' , 'cyan' , 'blue' , 'magenta' ]
1395
1395
with mpl .rc_context ({'hatch.color' : 'edge' }):
1396
1396
# edgecolor and hatchcolor is set
1397
1397
col = PathCollection ([path ], hatch = '//' ,
1398
- edgecolor = colors_1 , hatchcolor = colors_2 )
1399
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_2 ))
1398
+ edgecolor = edgecolors , hatchcolor = hatchcolors )
1399
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (hatchcolors ))
1400
1400
1401
1401
# explicitly setting edgecolor and then hatchcolor
1402
1402
col = PathCollection ([path ], hatch = '//' )
1403
- col .set_edgecolor (colors_1 )
1404
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_1 ))
1405
- col .set_hatchcolor (colors_2 )
1406
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_2 ))
1403
+ col .set_edgecolor (edgecolors )
1404
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (edgecolors ))
1405
+ col .set_hatchcolor (hatchcolors )
1406
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (hatchcolors ))
1407
1407
1408
1408
# explicitly setting hatchcolor and then edgecolor
1409
1409
col = PathCollection ([path ], hatch = '//' )
1410
- col .set_hatchcolor (colors_1 )
1411
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_1 ))
1412
- col .set_edgecolor (colors_2 )
1413
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_1 ))
1410
+ col .set_hatchcolor (hatchcolors )
1411
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (hatchcolors ))
1412
+ col .set_edgecolor (edgecolors )
1413
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (hatchcolors ))
1414
1414
1415
1415
1416
1416
def test_collection_hatchcolor_fallback_logic ():
1417
1417
from matplotlib .collections import PathCollection
1418
1418
path = mpath .Path .unit_rectangle ()
1419
1419
1420
- colors_1 = ['purple' , 'red' , 'green' , 'yellow' ]
1421
- colors_2 = ['orange' , 'cyan' , 'blue' , 'magenta' ]
1420
+ edgecolors = ['purple' , 'red' , 'green' , 'yellow' ]
1421
+ hatchcolors = ['orange' , 'cyan' , 'blue' , 'magenta' ]
1422
1422
1423
1423
# hatchcolor parameter should take precedence over rcParam
1424
1424
# When edgecolor is not set
1425
1425
with mpl .rc_context ({'hatch.color' : 'green' }):
1426
- col = PathCollection ([path ], hatch = '//' , hatchcolor = colors_1 )
1427
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_1 ))
1426
+ col = PathCollection ([path ], hatch = '//' , hatchcolor = hatchcolors )
1427
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (hatchcolors ))
1428
1428
# When edgecolor is set
1429
1429
with mpl .rc_context ({'hatch.color' : 'green' }):
1430
1430
col = PathCollection ([path ], hatch = '//' ,
1431
- edgecolor = colors_2 , hatchcolor = colors_1 )
1432
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_1 ))
1431
+ edgecolor = edgecolors , hatchcolor = hatchcolors )
1432
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (hatchcolors ))
1433
1433
1434
1434
# hatchcolor should not be overridden by edgecolor when
1435
1435
# hatchcolor parameter is not passed and hatch.color rcParam is set to a color
1436
1436
with mpl .rc_context ({'hatch.color' : 'green' }):
1437
1437
col = PathCollection ([path ], hatch = '//' )
1438
1438
assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array ('green' ))
1439
- col .set_edgecolor (colors_1 )
1439
+ col .set_edgecolor (edgecolors )
1440
1440
assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array ('green' ))
1441
1441
1442
1442
# hatchcolor should match edgecolor when
1443
1443
# hatchcolor parameter is not passed and hatch.color rcParam is set to 'edge'
1444
1444
with mpl .rc_context ({'hatch.color' : 'edge' }):
1445
- col = PathCollection ([path ], hatch = '//' , edgecolor = colors_1 )
1446
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_1 ))
1445
+ col = PathCollection ([path ], hatch = '//' , edgecolor = edgecolors )
1446
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (edgecolors ))
1447
1447
# hatchcolor parameter is set to 'edge'
1448
- col = PathCollection ([path ], hatch = '//' , edgecolor = colors_1 , hatchcolor = 'edge' )
1449
- assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (colors_1 ))
1448
+ col = PathCollection ([path ], hatch = '//' , edgecolor = edgecolors , hatchcolor = 'edge' )
1449
+ assert_array_equal (col .get_hatchcolor (), mpl .colors .to_rgba_array (edgecolors ))
1450
1450
1451
1451
# default hatchcolor should be used when hatchcolor parameter is not passed and
1452
1452
# hatch.color rcParam is set to 'edge' and edgecolor is not set
0 commit comments