diff --git a/galleries/examples/color/named_colors.py b/galleries/examples/color/named_colors.py index c6cba68ab434..0181e0f06742 100644 --- a/galleries/examples/color/named_colors.py +++ b/galleries/examples/color/named_colors.py @@ -42,14 +42,14 @@ def plot_colortable(colors, *, ncols=4, sort_colors=True): n = len(names) nrows = math.ceil(n / ncols) - width = cell_width * 4 + 2 * margin + width = cell_width * ncols + 2 * margin height = cell_height * nrows + 2 * margin dpi = 72 fig, ax = plt.subplots(figsize=(width / dpi, height / dpi), dpi=dpi) fig.subplots_adjust(margin/width, margin/height, (width-margin)/width, (height-margin)/height) - ax.set_xlim(0, cell_width * 4) + ax.set_xlim(0, cell_width * ncols) ax.set_ylim(cell_height * (nrows-0.5), -cell_height/2.) ax.yaxis.set_visible(False) ax.xaxis.set_visible(False)