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

Skip to content

Commit b49bcb1

Browse files
committed
Format
1 parent c9bf557 commit b49bcb1

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/matplotlib/tests/test_collections.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ def test_quadmesh_set_array():
661661
fig.canvas.draw()
662662
assert np.array_equal(coll.get_array(), np.ones(9))
663663

664-
def test_legend_size_with_inverse_relationship():
664+
665+
def test_legend_inverse_size_label_relationship():
665666
'''
666667
Ensure legend markers scale appropriately when label and size are inversely related.
667668
Here label = 5 / size
@@ -673,13 +674,13 @@ def test_legend_size_with_inverse_relationship():
673674
C = 1 - np.random.random(50)
674675
S = 5 / C
675676

676-
leg_sizes = [0.2, 0.4, 0.6, 0.8]
677+
legend_sizes = [0.2, 0.4, 0.6, 0.8]
677678
fig, ax = plt.subplots()
678679
sc = ax.scatter(X, Y, s=S)
679-
handles, labels = sc.legend_elements(prop='sizes', num=leg_sizes, func=lambda x: 5 / x)
680+
handles, labels = sc.legend_elements(prop='sizes', num=legend_sizes, func=lambda s: 5 / s)
680681

681682
# Convert markersize scale to 's' scale
682683
handle_sizes = [x.get_markersize() for x in handles]
683684
handle_sizes = [5 / x**2 for x in handle_sizes]
684685

685-
assert_array_almost_equal(handle_sizes, leg_sizes, decimal=1)
686+
assert_array_almost_equal(handle_sizes, legend_sizes, decimal=1)

0 commit comments

Comments
 (0)