Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print list of palettes on invalid palette choice #3535

Closed
wants to merge 3 commits into from
Closed
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: 9 additions & 1 deletion seaborn/palettes.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,15 @@ def color_palette(palette=None, n_colors=None, desat=None, as_cmap=False):
# Perhaps a named matplotlib colormap?
palette = mpl_palette(palette, n_colors, as_cmap=as_cmap)
except (ValueError, KeyError): # Error class changed in mpl36
raise ValueError(f"{palette!r} is not a valid palette name")
valid_palettes = [
cm for cm in
QUAL_PALETTES + list(mpl.colormaps)
if cm != 'jet'
]
raise ValueError(
f"{palette!r} is not a valid palette name.\n"
f" Valid palettes include {valid_palettes}."
)

if desat is not None:
palette = [desaturate(c, desat) for c in palette]
Expand Down
Loading