
Hao B.
V1
2022/12/29阅读:28主题:重影
优化SCI作图
优化科研数据图系列
让SCI作图变得更简单、更规范和更好看。
https://doi.org/10.1021/acsomega.1c03814
1 结果展示和对比
2 源码文件
% ----------PART ONE----------%
% 读入文件的路径
lower = fullfile("D:\Sci_Graph", "lower.xlsx");
lower = readtable(lower, "Range", "A1:B10000", "Sheet", "lower", "ReadVariableNames", false);
equal = fullfile("D:\Sci_Graph", "equal.xlsx");
equal = readtable(equal, "Range", "A1:B10000", "Sheet", "equal", "ReadVariableNames", false);
higher = fullfile("D:\Sci_Graph", "higher.xlsx");
higher = readtable(higher, "Range", "A1:B10000", "Sheet", "higher", "ReadVariableNames", false);
% 调用数据
t_lower = lower(:, 1).Var1;
loc_lower = isnan(t_lower);
t_lower(loc_lower) = [];
lower = lower(:, 2).Var2;
loc_lower = isnan(lower);
lower(loc_lower) = [];
%可选择“数据光顺和优化”
% lower = smoothdata(lower, "sgolay");
t_equal = equal(:, 1).Var1;
loc_equal = isnan(t_equal);
t_equal(loc_equal) = [];
equal = equal(:, 2).Var2;
loc_equal = isnan(equal);
equal(loc_equal) = [];
t_higher = higher(:, 1).Var1;
loc_higher = isnan(t_higher);
t_higher(loc_higher) = [];
higher = higher(:, 2).Var2;
loc_higher = isnan(higher);
higher(loc_higher) = [];
% ----------PART TWO----------%
% 绘图
frame_tiledlayout(1, 1, "compact", "tight");
nexttile;
hold on
p_equal = plot(t_equal, equal);
p_equal.LineStyle = "-";
p_equal.LineWidth = 1.2;
p_equal.Color = "r";
p_equal.Marker = "o";
p_equal.MarkerSize = 7;
p_equal.MarkerEdgeColor = "r";
p_equal.MarkerFaceColor = "k";
p_equal.MarkerIndices = 1 : 2 : length(equal);
p_lower = plot(t_lower, lower);
p_lower.LineStyle = "-";
p_lower.LineWidth = 1.2;
p_lower.Color = "b";
p_lower.Marker = "s";
p_lower.MarkerSize = 7.4;
p_lower.MarkerEdgeColor = "b";
p_lower.MarkerFaceColor = "r";
p_lower.MarkerIndices = 1 : 2 : length(lower);
p_higher = plot(t_higher, higher);
p_higher.LineStyle = "-";
p_higher.LineWidth = 1.2;
p_higher.Color = "k";
p_higher.Marker = "d";
p_higher.MarkerSize = 7;
p_higher.MarkerEdgeColor = "k";
p_higher.MarkerFaceColor = "#7E2F8E";
p_higher.MarkerIndices = 1 : 3 : length(higher);
hold off
% 设置轴属性
ax = gca;
ax.LineWidth = 1;
ax.FontName = "Arial";
ax.FontSize = 12;
ax.Box = "on";
ax.XColor = "k";
ax.YColor = "k";
ax.XLim = [floor(min(t_lower)), ceil(max(t_higher)+3)];
ax.YLim = [floor(min(higher)), 450];
ax.TickDir = "in";
ax.XMinorTick = "on";
ax.YMinorTick = "on";
ax.XMinorGrid = "on";
ax.YMinorGrid = "on";
ax.MinorGridLineStyle = ":";
ax.XAxis.TickLabelFormat = "%.d";
ax.YAxis.TickLabelFormat = "%.d";
% 设置轴标题
xlb = xlabel("Time(ms)");
xlb.FontSize = 14;
xlb.FontName = "Arial";
xlb.Color = "k";
xlb.FontWeight = "bold";
ylb = ylabel("Flame front position(mm)");
ylb.FontSize = 14;
ylb.FontName = "Arial";
ylb.Color = "k";
ylb.FontWeight = "bold";
% 设置图例
lgd = legend("Equal", "Lower", "Higher");
lgd.FontName = "Arial";
lgd.FontSize = 12;
lgd.Location = "northwest";
lgd.TextColor = "k";
lgd.Box = "on";
lgd.LineWidth = 0.8;
lgd.NumColumns = 1;
欢迎讨论和纠错。
作者介绍

Hao B.
V1