Add new color palettes with interactive palette widgets #286

Merged
merged 12 commits into from Sep 21, 2014

Conversation

Projects
None yet
3 participants
@mwaskom
Owner

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))

light_pal

  • 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))

diverg_pal

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"))

xkcd_pal

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 from Add new color palettes with interactive palette choosers to Add new color palettes with interactive palette widgets Sep 9, 2014

@mwaskom mwaskom referenced this pull request in matplotlib/matplotlib Sep 9, 2014

Closed

What's the best way to make a matplotlib colormap mutable? #3491

@@ -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.")

This comment has been minimized.

@tacaswell

tacaswell Sep 10, 2014

This made me laugh.

@tacaswell

tacaswell Sep 10, 2014

This made me laugh.

@mwaskom

This comment has been minimized.

Show comment
Hide comment
@mwaskom

mwaskom Sep 10, 2014

Owner

See also matplotlib/matplotlib#3491 for related discussion

Owner

mwaskom commented Sep 10, 2014

See also matplotlib/matplotlib#3491 for related discussion

@phobson

This comment has been minimized.

Show comment
Hide comment
@phobson

phobson Sep 10, 2014

Contributor

so cool 👍

Contributor

phobson commented Sep 10, 2014

so cool 👍

mwaskom added a commit that referenced this pull request Sep 21, 2014

Merge pull request #286 from mwaskom/more_color_palettes
Add new color palettes with interactive palette widgets

@mwaskom mwaskom merged commit f43a5ce into master Sep 21, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@mwaskom mwaskom deleted the more_color_palettes branch Sep 21, 2014

@pyup-bot pyup-bot referenced this pull request in mayou36/raredecay May 18, 2017

Closed

Pin seaborn to latest version 0.7.1 #10

@pyup-bot pyup-bot referenced this pull request in tnir/pandas Feb 2, 2018

Open

Pin seaborn to latest version 0.8.1 #14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment