Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/color/named_colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@

n = len(sorted_names)
ncols = 4
nrows = n // ncols + 1
nrows = n // ncols

fig, ax = plt.subplots(figsize=(8, 5))
fig, ax = plt.subplots(figsize=(9, 8))

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

for i, name in enumerate(sorted_names):
col = i % ncols
row = i // ncols
row = i % nrows
col = i // nrows
y = Y - (row * h) - h

xi_line = w * (col + 0.05)
xf_line = w * (col + 0.25)
xi_text = w * (col + 0.3)

ax.text(xi_text, y, name, fontsize=(h * 0.8),
ax.text(xi_text, y, name, fontsize=(h * 0.5),
horizontalalignment='left',
verticalalignment='center')

Expand Down