import matplotlib
import numpy
as np
import matplotlib
.pyplot
as plt
from matplotlib
import rcParams
matplotlib
.use
("pgf")
pgf_config
= {
"font.family": 'serif',
"font.size": 7.5,
"pgf.rcfonts": False,
"text.usetex": True,
"pgf.preamble": [
r
"\usepackage{unicode-math}",
r
"\setmainfont{Times New Roman}",
r
"\usepackage{xeCJK}",
r
"\setCJKmainfont{SimSun}",
],
}
rcParams
.update
(pgf_config
)
plt
.rcParams
['xtick.direction'] = 'in'
plt
.rcParams
['ytick.direction'] = 'in'
x
= [1,2,3,4,5]
y_y
=[0.5,0.6,0.7,0.8,0.9]
for i
in range(len(y_y
)):
plt
.text
(x
[i
], y_y
[i
]+0.01, '%.3f' %(y_y
[i
]),ha
='center')
plt
.plot
(x
, y_y
,'rp--')
plt
.xlim
((0.8, 5.2))
plt
.ylim
((0.8, 1))
plt
.xticks
(x
)
plt
.xlabel
('横纵')
plt
.ylabel
('纵轴')
plt
.title
('标题')
plt
.savefig
('./集成2.png', dpi
=800)
第一次运行需要安装插件,需要等待一会,安装完毕重新运行等待运行结束,查看保存图片的路径即可
转载请注明原文地址:https://blackberry.8miu.com/read-8567.html