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

Skip to content

Commit c0a60b7

Browse files
authored
Merge pull request #11659 from meeseeksmachine/auto-backport-of-pr-11658-on-v2.2.2-doc
Backport PR #11658 on branch v2.2.2-doc
2 parents 85b4eb8 + 9867b44 commit c0a60b7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/color/named_colors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@
2626

2727
n = len(sorted_names)
2828
ncols = 4
29-
nrows = n // ncols + 1
29+
nrows = n // ncols
3030

31-
fig, ax = plt.subplots(figsize=(8, 5))
31+
fig, ax = plt.subplots(figsize=(9, 8))
3232

3333
# Get height and width
3434
X, Y = fig.get_dpi() * fig.get_size_inches()
3535
h = Y / (nrows + 1)
3636
w = X / ncols
3737

3838
for i, name in enumerate(sorted_names):
39-
col = i % ncols
40-
row = i // ncols
39+
row = i % nrows
40+
col = i // nrows
4141
y = Y - (row * h) - h
4242

4343
xi_line = w * (col + 0.05)
4444
xf_line = w * (col + 0.25)
4545
xi_text = w * (col + 0.3)
4646

47-
ax.text(xi_text, y, name, fontsize=(h * 0.8),
47+
ax.text(xi_text, y, name, fontsize=(h * 0.5),
4848
horizontalalignment='left',
4949
verticalalignment='center')
5050

0 commit comments

Comments
 (0)