Skip to content
Open
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
8 changes: 5 additions & 3 deletions pandas/plotting/_matplotlib/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ def _get_colors_from_colormap(
) -> list[Color]:
"""Get colors from colormap."""
cmap = _get_cmap_instance(colormap)
return [cmap(num) for num in np.linspace(0, 1, num=num_colors)]
vals = np.linspace(0, 1, num=num_colors)
res = cmap(vals)
return [tuple(color) for color in res]


def _get_cmap_instance(colormap: str | Colormap) -> Colormap:
Expand All @@ -199,10 +201,10 @@ def _get_colors_from_color(
raise ValueError(f"Invalid color argument: {color}")

if _is_single_color(color):
color = cast(Color, color)
color = cast("Color", color)
return [color]

color = cast(Collection[Color], color)
color = cast("Collection[Color]", color)
return list(_gen_list_of_colors_from_iterable(color))


Expand Down