在matplotlib中,默认的颜色盘通过参数rcParams["axes.prop_cycle"]参数来指定, 初始的调色盘就是T10调色盘。 T10调色盘适用于离散分类,其颜色名称以tab:为前缀,具体的包含了以下10种颜色 1. tab:blue 2. tab:orange 3. tab:green 4. tab:red 5. tab:purple 6. tab:brown 7. tab:
'T10' 分类调色板中的一种 Tableau 颜色(默认颜色循环):{'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'} 8. ’CN‘颜色 “CN”颜色规范,即'C'后面跟着一个数字,它是默认属性循环的索引(matplotlib.rcPa...
X11/CSS4 颜色名 前缀为 xkcd: 的xkcd color table[注1]中的颜色名。比如: xkcd: sky blue {'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'} 其中之一 {'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:...
你可以在绘图函数中直接使用Tab Colors的名称来指定颜色。 importmatplotlib.pyplotasplt plt.figure(figsize=(8,6))plt.plot([1,2,3,4],[1,4,2,3],color='tab:blue',label='Line 1')plt.plot([1,2,3,4],[2,3,4,1],color='tab:orange',label='Line 2')plt.title('How to use Tab Colors...
import matplotlib.pyplot as plt# 3.假设我们有以下数据labels = ['tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan']sizes = [30, 20, 15, 25, 10, 12, 18, 22, 14, 16] # 这些数据代表每个label...
color = 'tab:blue' ax2.set_ylabel('温度 (°C)', color=color) ax2.plot(months, temperatures, color=color, marker='s', linestyle='--', label='温度') ax2.tick_params(axis='y', labelcolor=color) ax2.legend(loc='upper right') # 显示图表 plt.title('月份销售额与温度对比图') plt...
e.g. 'tab:blue'; 2、matplotlib颜色使用方法 #源自官网实例importmatplotlib.pyplotaspltimportnumpyasnpt=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 ...
使用预设的颜色渐变 Matplotlib提供了一系列预设的颜色渐变(colormap),可以帮助你轻松地为数据添加色彩变化。比如,`viridis`和`plasma`等渐变色谱能够根据数值大小自然过渡,非常适合用于显示连续型数据的变化趋势。对于分类数据,像`tab10`这样的颜色映射则可以提供一组互不相同的颜色,使不同的类别清晰可辨。import ...
()# 绘制柱状图color='tab:blue'ax1.set_xlabel('Categories')ax1.set_ylabel('Values',color=color)bars=ax1.bar(categories,values,color=color)ax1.bar_label(bars,labels=[f'{val*100:.2f}%'forvalinpercentages])ax1.tick_params(axis='y',labelcolor=color)# 绘制累积百分比的折线图ax2=ax1....
'T10' 分类调色板中的一种 Tableau 颜色(默认颜色循环):{'tab:blue', 'tab:orange', 'tab:green', 'tab:red', 'tab:purple', 'tab:brown', 'tab:pink', 'tab:gray', 'tab:olive', 'tab:cyan'}(不区分大小写); “CN”颜色规范,即'C'后面跟着一个数字,它是默认属性循环的索引(matplotlib.rcPa...