pythonmatplot绘图整理,中⽂显⽰,坐标轴,标记,柱状图1. 中⽂标注
windows+linux
Mac
from matplotlib.font_manager import FontManager
fm = FontManager()
mat_fonts = t(f.name for f flist)
print(mat_fonts)
2. 表头
plt.title(ylabel, fontsize=fs)
3. xy轴边界
吉祥物的英文plt.xlim(0.5, 5.5)
plt.ylim(0.5, 1.0)
4. xy轴刻度
5. xy轴标签
fig.t_xticklabels('%.1f'%i for i in range(10) , fontsize=12 )# x轴刻度标签
fig.t_yticklabels("%.2f" %i for i in [0,0.2,0.4,0.6,0.8,1.0,1.2]) # y轴刻度标签
6. 图例
plt.legend(loc = 'best')
# 显⽰图例,loc表⽰位置
# 'best' : 0, (only implemented for axes legends)(⾃适应⽅式)
环燕打一成语# 'upper right' : 1,
# 'upper left' : 2,
# 'lower left' : 3,
# 'lower right' : 4,
# 'right' : 5,
# 'center left' : 6,
# 'center right' : 7,
# 'lower center' : 8,
# 'upper center' : 9,
# 'center' : 10,
7. 在图中显⽰⽂字标注
#三个参数分别为x,y,要显⽰的内容
<(xloc,yloc,str)
相反的词语8. 多张图
加工中心数控
#定义figrue
plt.figure(figsize=(18,8))
ax = plt.subplot2grid( (2,2) , 0 , 0 )
ax.(x , y ,'*--' , c='r' , label=’x1’)
9.
ax.bar(x , line1,color='white', edgecolor='black' , hatch='//')
Y = np.linspace(0,1,12)
元日的古诗X = np.ones(Y.size)
markers = ['.',',','o','v','^','<','>','1','2','3','4',
's','p','*','h','H','+','x','D','d','|','_', r'$\clubsuit$']
fig = plt.figure(figsize=(8,6), dpi=72, facecolor="white")
axes = plt.subplot(111)
for i,marker in enumerate(markers):
axes.plot( (1+i)*X, Y, color = '0.9', linewidth=1,
markersize = 13, marker=marker, markeredgecolor = '0.10', markerfacecolor = '0.75') plt.show()
import numpy as np个人离职申请简短
import .pyplot as plt
X = np.linspace(0,1,10)
Y = np.ones(X.size)
patterns = ('/','//','-', '+', 'x', '\\', '\\\\', '*', 'o', 'O', '.')
fig = plt.figure(figsize=(8,6), dpi=72, facecolor="white")
axes = plt.subplot(111)
for i,pattern in enumerate(patterns):
安全标志简笔画axes.bar( .5+i, 1, hatch=pattern, color='white', edgecolor='blue',) axes.t_xlim(0,len(patterns)+.5)
axes.t_ylim(0,1)
axes.t_yticks([])
axes.t_xticks(np.arange(1,len(patterns)+1))
axes.t_xticklabels(patterns)
plt.show()真心话题目
10. 美化风格
plt.style.u('ggplot')