- Seaborn 教程
- Seaborn - 首頁
- Seaborn - 簡介
- Seaborn - 環境設定
- 匯入資料集和庫
- Seaborn - 圖形美觀
- Seaborn - 調色盤
- Seaborn - 直方圖
- Seaborn - 核密度估計
- 視覺化成對關係
- Seaborn - 繪製分類資料
- 觀測值的分佈
- Seaborn - 統計估計
- Seaborn - 繪製寬格式資料
- 多面板分類圖
- Seaborn - 線性關係
- Seaborn - Facet Grid
- Seaborn - Pair Grid
- 函式參考
- Seaborn - 函式參考
- Seaborn 有用資源
- Seaborn - 快速指南
- Seaborn - 有用資源
- Seaborn - 討論
Seaborn.crayon_palette() 方法
Seaborn.crayon_palette() 方法用於建立使用彩虹蠟筆顏色名稱的調色盤。顏色取自彩虹蠟筆顏色的維基百科頁面。
此方法是 seaborn.crayons 字典的簡單包裝器。也就是說,它將所有顏色列表作為 RGB 元組返回到一個類似於其他 seaborn 調色盤的物件中。
語法
以下是 seaborn.crayon_palette() 方法的語法:
seaborn.crayon_palette(colors)
引數
此方法的引數如下:
| 序號 | 引數和描述 |
|---|---|
| 1 | 顏色 接受 seaborn.crayons 字典中鍵的字串列表。 |
返回值
此方法返回一個 Seaborn 調色盤。
示例 1
我們將不得不傳遞一個字串列表作為輸入,這些字串是顏色名稱,然後顏色作為調色盤作為輸出生成。字串應為 seaborn.crayon 字典的一部分。
import seaborn as sns import matplotlib.pyplot as plt data = sns.crayon_palette(["Sepia","Sunglow","Vivid Violet"]) sns.palplot(data) plt.show()
輸出
輸出如下:
示例 2
在此示例中,我們將傳遞一些其他顏色並瞭解字典中不同的顏色。
import seaborn as sns import matplotlib.pyplot as plt data = sns.crayon_palette(["Wild Watermelon","Wisteria","Wild Strawberry"]) sns.palplot(data) plt.show()
輸出
輸出如下:
示例 3
在此示例中,我們將傳遞一些其他顏色並瞭解字典中不同的顏色。我們必須將字典中鍵的名稱作為引數傳遞。不能傳遞作為鍵值的十六進位制值。
import seaborn as sns import matplotlib.pyplot as plt data = sns.crayon_palette(['Outer Space',"Purple Heart","Vivid Tangerine","Orchid","Raw Sienna"]) sns.palplot(data) plt.show()
輸出
輸出如下:
seaborn_color_palettes_introduction.htm
廣告