seaborn.light_palette#

seaborn.light_palette(color, n_colors=6, reverse=False, as_cmap=False, input='rgb')#

建立一個從淺色混合到 color 的連續調色盤。

color 參數可以用多種方式指定,包括 matplotlib 中定義顏色的所有選項,以及 seaborn 處理的幾個額外色彩空間。您也可以使用 XKCD 顏色調查中的命名顏色資料庫。

如果您正在使用 Jupyter Notebook,您也可以使用 choose_light_palette() 函數以互動方式選擇此調色盤。

參數:
color高值的基礎顏色

十六進位碼、html 顏色名稱,或在 input 空間中的元組。

n_colorsint,選填

調色盤中的顏色數量

reversebool,選填

如果為 True,則反轉混合的方向

as_cmapbool,選填

如果為 True,則返回 matplotlib.colors.ListedColormap

input{'rgb', 'hls', 'husl', xkcd'}

用於解釋輸入顏色的色彩空間。前三個選項適用於元組輸入,而後者適用於字串輸入。

返回:
調色盤

RGB 元組列表或 matplotlib.colors.ListedColormap

另請參閱

dark_palette

建立一個低值為深色的連續調色盤。

diverging_palette

建立一個具有兩種顏色的發散調色盤。

範例

定義一個從淺灰色到指定顏色的連續漸變

sns.light_palette("seagreen")

使用十六進位碼指定顏色

sns.light_palette("#79C")

從 husl 系統指定顏色

sns.light_palette((20, 60, 50), input="husl")

增加顏色數量

sns.light_palette("xkcd:copper", 8)

返回連續色彩圖而非離散調色盤

sns.light_palette("#a275ac", as_cmap=True)
blend color map