網(wǎng)站首頁 編程語言 正文
1、matplotlib支持的顏色格式
1.RGB 或者 RGBA 元組格式顏色
元組中浮點(diǎn)型數(shù)值位于 [0, 1] 之間,e.g(0.1, 0.2, 0.5) 或 (0.1, 0.2, 0.5, 0.3). RGA即Red, Green, Blue;RGBA即Red, Green, Blue, Alpha;
2.RGB or RGBA對(duì)應(yīng)的hex 格式顏色
(e.g., '#0F0F0F' or '#0F0F0F0F');
3.[0,1]之間的任意浮點(diǎn)數(shù)
(e.g., '0.5'),其中0為純黑色,1為白色;
4.{'b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'}幾種基本色;
5.X11/CSS4中的顏色
e.g. "blue";
6.xkcd中的顏色
e.g., 'purple (#7e1e9c)';
7.'Cn'格式顏色
matplotlib.rcParams['axes.prop_cycle']可輸出所有顏色,['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf'],'C0'對(duì)應(yīng)'#1f77b4',依次類推;
8.Tableau 的colormap中顏色
e.g. 'tab:blue';
2、matplotlib顏色使用方法
#源自官網(wǎng)實(shí)例 import matplotlib.pyplot as plt import numpy as np t = np.linspace(0.0, 2.0, 201) s = np.sin(2 * np.pi * t) # 1) RGB tuple: fig, ax = plt.subplots(facecolor=(.18, .31, .31),figsize=(10,5)) # 2) hex string: ax.set_facecolor('#eafff5') # 3) gray level string: ax.set_title('Voltage vs. time chart', color='0.7') # 4) single letter color string ax.set_xlabel('time (s)', color='c') # 5) a named color: ax.set_ylabel('voltage (mV)', color='peachpuff') # 6) a named xkcd color: ax.plot(t, s, 'xkcd:crimson') # 7) Cn notation: ax.plot(t, .7*s, color='C4', linestyle='--') # 8) tab notation: ax.tick_params(labelcolor='tab:orange') plt.show()
3、matplotlib內(nèi)置單顏色色號(hào)
matplotlib內(nèi)置的顏色可以使用matplotlib.colors 調(diào)用,有'BASE_COLORS','TABLEAU_COLORS','CSS4_COLORS'及 'XKCD_COLORS'四類。使用matplotlib.colors.類名稱可輸出顏色號(hào)。
'BASE_COLORS'色號(hào)
b (0, 0, 1) g (0, 0.5, 0) r (1, 0, 0) c (0, 0.75, 0.75) m (0.75, 0, 0.75) y (0.75, 0.75, 0) k (0, 0, 0) w (1, 1, 1)
'BASE_COLORS'色圖?
TABLEAU_COLORS色號(hào)
tab:blue #1f77b4 tab:orange #ff7f0e tab:green #2ca02c tab:red #d62728 tab:purple #9467bd tab:brown #8c564b tab:pink #e377c2 tab:gray #7f7f7f tab:olive #bcbd22 tab:cyan #17becf
TABLEAU_COLORS色圖?
CSS4_COLORS色號(hào)
共計(jì)148種顏色。?
顏色名稱 hex色號(hào) aliceblue #F0F8FF antiquewhite #FAEBD7 aqua #00FFFF aquamarine #7FFFD4 azure #F0FFFF beige #F5F5DC bisque #FFE4C4 black #000000
CSS4_COLORS色圖?
XKCD_COLORS色號(hào)
共計(jì)949種色號(hào)。
xkcd:cloudy blue #acc2d9 xkcd:dark pastel green #56ae57 xkcd:dust #b2996e xkcd:electric lime #a8ff04 xkcd:fresh green #69d84f xkcd:light eggplant #894585 xkcd:nasty green #70b23f xkcd:really light blue #d4ffff
XKCD_COLORS色圖
原文鏈接:https://blog.csdn.net/qq_21478261/article/details/106969074
相關(guān)推薦
- 2023-01-03 利用Rust實(shí)現(xiàn)一個(gè)簡單的Ping應(yīng)用_Rust語言
- 2022-11-19 GoLang中的iface?和?eface?的區(qū)別解析_Golang
- 2023-03-26 C#?cefSharep控件的使用詳情_C#教程
- 2022-03-17 VSCode如何遠(yuǎn)程連接Linux教程(vscode怎么連接ssh遠(yuǎn)程)
- 2022-07-12 Python根據(jù)交集、并集對(duì)比兩個(gè)文件
- 2023-05-23 docker-compose統(tǒng)一管理多個(gè)容器使用詳解_docker
- 2022-08-27 C#使用百度Ueditor富文本框?qū)崿F(xiàn)上傳文件_C#教程
- 2022-09-04 Go語言異常處理(Panic和recovering)用法詳解_Golang
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支