Seaborn: Using set with color_palette() output fails

Created on 20 Aug 2018  路  3Comments  路  Source: mwaskom/seaborn

When creating a color palette using the color_palette() function, an error is thrown in 0.9.0 when trying to pass the output to sns.set(). MWE:

import seaborn as sns

pal = sns.color_palette("husl")
sns.set(palette=pal)

This appears to be for all named palettes

Most helpful comment

I think that's a bug. Can be worked around right now by adding color_codes=False.

All 3 comments

What is the error

Traceback (most recent call last):
File "", line 1, in
File "/is/ei/vjayaram/anaconda/envs/moabb_p3/lib/python3.6/site-packages/seaborn/rcmod.py", line 121, in set
set_palette(palette, color_codes=color_codes)
File "/is/ei/vjayaram/anaconda/envs/moabb_p3/lib/python3.6/site-packages/seaborn/rcmod.py", line 549, in set_palette
palettes.set_color_codes(palette)
File "/is/ei/vjayaram/anaconda/envs/moabb_p3/lib/python3.6/site-packages/seaborn/palettes.py", line 1070, in set_color_codes
elif palette in SEABORN_PALETTES:
TypeError: unhashable type: '_ColorPalette'

I think that's a bug. Can be worked around right now by adding color_codes=False.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amelio-vazquez-reina picture amelio-vazquez-reina  路  4Comments

rrbarbosa picture rrbarbosa  路  3Comments

queryous picture queryous  路  4Comments

sofiatti picture sofiatti  路  4Comments

JanHomann picture JanHomann  路  3Comments