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

Skip to content

Commit ba2d7f8

Browse files
committed
Added entry in doc/users/next_whats_new/, as per checklist.
1 parent ba42251 commit ba2d7f8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

β€Ždoc/users/next_whats_new/callables_for_formatting_sankey_labels.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ the mapping of numbers to emoji.
1515
# on Windows, this font may be necessary to display emojis
1616
plt.rcParams['font.family'] = "Segoe UI Emoji"
1717

18-
def display_in_cats(values, min_cats, max_cats):
1918

19+
def display_in_cats(values, min_cats, max_cats):
2020
def display_in_cat_scale(value):
2121
max_value = max(values, key=abs)
22-
number_cats_to_show = max(min_cats, math.floor(abs(value) / max_value * max_cats))
22+
number_cats_to_show = \
23+
max(min_cats, math.floor(abs(value) / max_value * max_cats))
2324
return str(number_cats_to_show * '🐈')
2425

2526
return display_in_cat_scale
2627

28+
2729
flows = [35, 15, 40, -20, -15, -5, -40, -10]
2830
orientations = [-1, 1, 0, 1, 1, 1, -1, -1]
2931

@@ -41,6 +43,7 @@ the mapping of numbers to emoji.
4143

4244
diagrams[0].texts[2].set_text('')
4345

44-
plt.title(f'Sankey flows measured in cats \n🐈 = {max(flows, key=abs) / max_cats}')
46+
plt.title(f'Sankey flows measured in cats \n'
47+
f'🐈 = {max(flows, key=abs) / max_cats}')
4548

4649
plt.show()

0 commit comments

Comments
Β (0)