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

Add new color palettes with interactive palette widgets #286

merged 12 commits into from Sep 21, 2014


Copy link

@mwaskom mwaskom commented Sep 9, 2014

This PR has a few things all related to color palettes:

New palette functions:

  • light_palette(): complement to dark_palette but blend from a very light version of the seed color
sns.palplot(sns.light_palette("seagreen", 10))


  • diverging_palette(): Given two hues of equal lightness and saturation (chosen in HUSL space), make a diverging palette between them with either a light or
    a dark midpoint.
sns.palplot(sns.diverging_palette(220, 10, n=9))


New ways to specify custom sequential palettes

  • The dark_, light_, and blend_palette functions have a new input parameter that controls how the color argument is interpreted: in addition to the range of color specs built into matplotlib, this can also be hls or husl for coords in those systems or xkcd for a named color in the xkcd survey database.
sns.palplot(sns.dark_palette("sea", 8, input="xkcd"))


Interactive widgets to choose palettes

This is the most exciting part of the PR.

This complementes the choose_cubehelix (now renamed to choose_cubehelix_palette for consistency) function that was in 0.4 to cover most of the custom palette functions: choose_colorbrewer_palette, choose_dark_palette, choose_light_palette, and choose_diverging_palette:

screenshot 2014-09-09 08 30 26

But the really exciting part is that these functions now return either a list of colors or a matplotlib colormap (when as_cmap is True) so they can actually be used in part of a normal workflow to interactively choose a palette and then pass the returned object to seaborn or matplotlib functions:

screenshot 2014-09-09 08 29 20

To do

  • Tests
  • Docstrings
  • Tutorial documentation
  • Release notes
  • Rename choose_cubehelix

@mwaskom mwaskom changed the title Add new color palettes with interactive palette choosers Add new color palettes with interactive palette widgets Sep 9, 2014
@@ -103,6 +105,8 @@ def color_palette(name=None, n_colors=6, desat=None):
palette = hls_palette(n_colors)
elif name == "husl":
palette = husl_palette(n_colors)
elif name.lower() == "jet":
raise ValueError("No.")
Copy link

@tacaswell tacaswell Sep 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This made me laugh.

Copy link
Owner Author

@mwaskom mwaskom commented Sep 10, 2014

See also matplotlib/matplotlib#3491 for related discussion

Copy link

@phobson phobson commented Sep 10, 2014

so cool 👍

mwaskom added a commit that referenced this issue Sep 21, 2014
Add new color palettes with interactive palette widgets
@mwaskom mwaskom merged commit f43a5ce into master Sep 21, 2014
1 check passed
@mwaskom mwaskom deleted the more_color_palettes branch Sep 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

3 participants