8000 refactor: constant "ncols" to variables · matplotlib/matplotlib@eb68989 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb68989

Browse files
authored
refactor: constant "ncols" to variables
1 parent 813e41a commit eb68989

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

galleries/examples/color/named_colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def plot_colortable(colors, *, ncols=4, sort_colors=True):
4242
n = len(names)
4343
nrows = math.ceil(n / ncols)
4444

45-
width = cell_width * 4 + 2 * margin
45+
width = cell_width * ncols + 2 * margin
4646
height = cell_height * nrows + 2 * margin
4747
dpi = 72
4848

4949
fig, ax = plt.subplots(figsize=(width / dpi, height / dpi), dpi=dpi)
5050
fig.subplots_adjust(margin/width, margin/height,
5151
(width-margin)/width, (height-margin)/height)
52-
ax.set_xlim(0, cell_width * 4)
52+
ax.set_xlim(0, cell_width * ncols)
5353
ax.set_ylim(cell_height * (nrows-0.5), -cell_height/2.)
5454
ax.yaxis.set_visible(False)
5555
ax.xaxis.set_visible(False)

0 commit comments

Comments
 (0)
0