颜色搭配在画图的时候是比较重要的,这篇博文主要是来介绍几种颜色搭配方案。
(每个饼图的饼片标签就是相对应的十六进制颜色码)
第一种搭配方案:
%matplotlib inline
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
mpl.rcParams["font.sans-serif"]=["SimHei"]
mpl.rcParams["axes.unicode_minus"]=False
labels = ["8AC6D1","BBDED6","FAE3D9","FFB6B9"]
values = [10,10,10,10]
colors = ["#8AC6D1","#BBDED6","#FAE3D9","#FFB6B9"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
第二种搭配方案:
labels = ["FBD1B7","FEE9B2","F9FCE1","D3F6F3"]
values = [10,10,10,10]
colors = ["#FBD1B7","#FEE9b2","#F9FCE1","#D3F6F3"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
labels = ["C6F1D6","E0F5B9","FFBA92","FF8080"]
values = [10,10,10,10]
colors = ["#C6F1D6","#E0F5B9","#FFBA92","#FF8080"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
plt.savefig("E://3.png")
labels = ["FDDEDE","F5FEC0","CAF2D7","60A9A6"]
values = [10,10,10,10]
colors = ["#FDDEDE","#F5FEC0","#CAF2D7","#60A9A6"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
labels = ["BD83CE","E5B0EA","F1C6E7","F7E8F6"]
values = [10,10,10,10]
colors = ["#BD83CE","#E5B0EA","#F1C6E7","#F7E8F6"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
labels = ["99DDCC","F6F6F6","FFE2E2","BAD7DF"]
values = [10,10,10,10]
colors = ["#99DDCC","#F6F6F6","#FFE2E2","#BAD7DF"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
labels = ["537791","C1C0B9","F7F6E7","E7E6E1"]
values = [10,10,10,10]
colors = ["#537791","#C1C0B9","#F7F6E7","#E7E6E1"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
labels = ["7C7575","B8B0B0","DFD3D3","FBF0F0"]
values = [10,10,10,10]
colors = ["#7C7575","#B8B0B0","#DFD3D3","#FBF0F0"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
labels = ["83B582","D6E4AA","FFFFC5","F0DD92"]
values = [10,10,10,10]
colors = ["#E1C2DB","#FFF0F0","#FFE6EB","#EDDDF2"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
labels = ["C4F2C8","E6DAF7","E7EBC3","D8DDF0","EDD1D1"]
values = [10,10,10,10,10]
colors = ["#C4F2C8","#E6DAF7","#E7EBC3","#D8DDF0","#EDD1D1"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
第十一种:
the Economist 杂志常用颜色
labels = ["106D9C","5A92AD","00A2DE","08BAFF"]
values = [10,10,10,10]
colors = ["#106D9C","#5A92AD","#00A2DE","#08BAFF"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')
效果图:
第十二种:
The Wall Street Journal 常用配色:
labels = ["#B5B5B5","#393939","#E1E1E1"]
values = [10,10,10]
colors = ["#B5B5B5","#393939","#E1E1E1"]
plt.pie(values,
labels = labels,
explode = [0.05,0.05,0.05],
colors = colors,
pctdistance = 1.1,
labeldistance = 1.3)
plt.axis('equal')