Skip to content

Show cmap

pypalettes.show_cmap

show_cmap(*args, max_cols=8, spacing=0.1, square_size=1)

Show the colors from a colormap as a grid of colored squares.

Displays the colormap with one square per color, left-aligned, with a maximum number of columns per row. Automatically adjusts layout based on the number of colors.

Parameters:

Name Type Description Default
*args Any

Arguments to pass to load_cmap to load the desired colormap.

()
max_cols int

Maximum number of color squares per row.

8
spacing float

Spacing between squares.

0.1
square_size float

Size of each square.

1

Returns:

Type Description
Figure

matplotlib.figure.Figure: The figure object containing the colormap visualization.

Examples

# mkdocs: render
from pypalettes import show_cmap

show_cmap("Fun")
# mkdocs: render
from pypalettes import show_cmap

show_cmap("Acadia")
# mkdocs: render
from pypalettes import show_cmap

show_cmap("Sunset")