民治营销型网站制作,冷色网站,江阴企业网站建设,新手做哪类网站SCI#xff0c;CCF#xff0c;EI及核心期刊绘图宝典#xff0c;爆款持续更新#xff0c;助力科研#xff01;
本期分享#xff1a;
【SCI绘图】【曲线图系列2 python】多类别标签对比的曲线图#xff0c;文末附完整代码。 1.环境准备
python 3
import proplot as pp…SCICCFEI及核心期刊绘图宝典爆款持续更新助力科研
本期分享
【SCI绘图】【曲线图系列2 python】多类别标签对比的曲线图文末附完整代码。 1.环境准备
python 3
import proplot as pplt
import pandas as pdfrom proplot import rc 2.数据示例与读取
数据示例 68.52769 1.01941334E-118 1.04975387E-287 3.07499527E-220 4.62365918E-169 2.32835613E-134 68.58945 3.94732386E-118 8.59329295E-287 1.94218811E-219 2.33402749E-168 9.88293492E-134 68.65121 1.51971781E-117 6.98480839E-286 1.21860660E-218 1.17091842E-167 4.17021496E-133 68.71298 5.81756808E-117 5.63747055E-285 7.59578697E-218 5.83793125E-167 1.74935402E-132 68.77474 2.21436321E-116 4.51815464E-284 4.70360236E-217 2.89277108E-166 7.29548983E-132 68.83650 8.38099508E-116 3.59581184E-283 2.89366667E-216 1.42463282E-165 3.02481879E-131 68.89826 3.15422077E-115 2.84186785E-282 1.76863385E-215 6.97327187E-165 1.24687538E-130 68.96003 1.18045311E-114 2.23045665E-281 1.07401485E-214 3.39254761E-164 5.11017864E-130 69.02179 4.39314840E-114 1.73851547E-280 6.48002835E-214 1.64052134E-163 2.08232725E-129 69.08355 1.62586232E-113 1.34576744E-279 3.88462479E-213 7.88524556E-163 8.43669246E-129 69.14532 5.98387683E-113 1.03461776E-278 2.31386509E-212 3.76735665E-162 3.39872639E-128 69.20708 2.19019452E-112 7.89987107E-278 1.36947767E-211 1.78919283E-161 1.36141743E-127 读取数据
# 读取 txt 文件中的数据
data pd.read_csv(uv_curve.txt, headerNone, delim_whitespaceTrue)# 颜色、曲线格式以及标签
color_list [black, red, orange, blue, green]
label_list [label1, label2, label3, label4, label5]
style_list [-, --, --, --, --] 3.绘图展示
画布设置
# 设置绘图的默认参数如字体、字号等
rc[font.name] Arial
rc[title.size] 14
rc[label.size] 12
rc[font.size] 10.5
rc[tick.width] 1.3
rc[meta.width] 1.3
rc[label.weight] bold
rc[tick.labelweight] bold
rc[ytick.major.size] 4.6
rc[ytick.minor.size] 2.5
rc[xtick.major.size] 4.6
rc[xtick.minor.size] 2.5
绘制逻辑
# 创建画布
fig, ax pplt.subplots(figsize(6 * 0.9, 4 * 0.9))# 绘制多曲线图
x data.iloc[:, 0]
for i in range(len(data.columns) - 1):y data.iloc[:, i 1]ax.plot(x, y, linewidth1.3, colorcolor_list[i], labellabel_list[i], linestylestyle_list[i])# 设置图例
ax.legend(locur, ncols1, fontweightbold, frameFalse)# 格式化图像
fig.format(gridFalse, ylabelAbsorbance, xlabelWavelength (nm),xlim(80, 200), xminorlocator10, xlocator20, ylim(0, 10000), yminorlocator1000, ylocator2000
)fig.show()fig.savefig(uv.png, bbox_inchestight, dpi300) 完整代码
# -*- coding: utf-8 -*-
import proplot as pplt
import pandas as pdfrom proplot import rc# 读取 txt 文件中的数据
data pd.read_csv(uv_curve.txt, headerNone, delim_whitespaceTrue)# 颜色、曲线格式以及标签
color_list [black, red, orange, blue, green]
label_list [label1, label2, label3, label4, label5]
style_list [-, --, --, --, --]# 设置绘图的默认参数如字体、字号等
rc[font.name] Arial
rc[title.size] 14
rc[label.size] 12
rc[font.size] 10.5
rc[tick.width] 1.3
rc[meta.width] 1.3
rc[label.weight] bold
rc[tick.labelweight] bold
rc[ytick.major.size] 4.6
rc[ytick.minor.size] 2.5
rc[xtick.major.size] 4.6
rc[xtick.minor.size] 2.5# 创建画布
fig, ax pplt.subplots(figsize(6 * 0.9, 4 * 0.9))# 绘制多曲线图
x data.iloc[:, 0]
for i in range(len(data.columns) - 1):y data.iloc[:, i 1]ax.plot(x, y, linewidth1.3, colorcolor_list[i], labellabel_list[i], linestylestyle_list[i])# 设置图例
ax.legend(locur, ncols1, fontweightbold, frameFalse)# 格式化图像
fig.format(gridFalse, ylabelAbsorbance, xlabelWavelength (nm),xlim(80, 200), xminorlocator10, xlocator20, ylim(0, 10000), yminorlocator1000, ylocator2000
)fig.show()fig.savefig(uv.png, bbox_inchestight, dpi300)