Hao B.

V1

2022/12/28阅读:17主题:重影

优化科研数据图系列

优化科研数据图系列

  • 节选自:https://doi.org/10.1016/j.combustflame.2022.112560
  • 文献来源

1 优化对比

2 源码文件

% ---------PART ONE---------- %

% 读取数据
blue_01 = fullfile("D:\DataBank\Professional_Work" + ...
    "\Office_Work\Blogs\Sci_Graph\1228""blue_01.xlsx");
blue_01 = readtable(blue_01, "Range""A1:B10000""Sheet""blue_01""ReadVariableNames"false);

blue_02 = fullfile("D:\DataBank\Professional_Work" + ...
    "\Office_Work\Blogs\Sci_Graph\1228""blue_02.xlsx");
blue_02 = readtable(blue_02, "Range""A1:B10000""Sheet""blue_02""ReadVariableNames"false);

red_01 = fullfile("D:\DataBank\Professional_Work" + ...
    "\Office_Work\Blogs\Sci_Graph\1228""red_01.xlsx");
red_01 = readtable(red_01, "Range""A1:B10000""Sheet""red_01""ReadVariableNames"false);

red_02 = fullfile("D:\DataBank\Professional_Work" + ...
    "\Office_Work\Blogs\Sci_Graph\1228""red_02.xlsx");
red_02 = readtable(red_02, "Range""A1:B10000""Sheet""red_02""ReadVariableNames"false);

% 调用数据
t_blue_01 = blue_01(:, 1).Var1;
loc_blue_01 = isnan(t_blue_01);
t_blue_01(loc_blue_01) = [];
blue_01 = blue_01(:, 2).Var2;
loc_blue_01 = isnan(blue_01);
blue_01(loc_blue_01) = [];

t_blue_02 = blue_02(:, 1).Var1;
loc_blue_02 = isnan(t_blue_02);
t_blue_02(loc_blue_02) = [];
blue_02 = blue_02(:, 2).Var2;
loc_blue_02 = isnan(blue_02);
blue_02(loc_blue_02) = [];

t_red_01 = red_01(:, 1).Var1;
loc_red_01 = isnan(t_red_01);
t_red_01(loc_red_01) = [];
red_01 = red_01(:, 2).Var2;
loc_red_01 = isnan(red_01);
red_01(loc_red_01) = [];

t_red_02 = red_02(:, 1).Var1;
loc_red_02 = isnan(t_red_02);
t_red_02(loc_red_02) = [];
red_02 = red_02(:, 2).Var2;
loc_red_02 = isnan(red_02);
red_02(loc_red_02) = [];

% ---------PART TWO---------- %

% 绘图
frame_tiledlayout(11"compact""tight"); % 函数简单的封装

nexttile;

yyaxis left
hold on

p_red_02 = plot(t_red_02, red_02);
p_red_02.LineStyle = "-";
p_red_02.LineWidth = 1.5;
p_red_02.Color = "r";
p_red_02.Marker = "o";
p_red_02.MarkerSize = 7;
p_red_02.MarkerEdgeColor = "r";
p_red_02.MarkerFaceColor = "k";
p_red_02.MarkerIndices = 1 : 5 : length(red_02);

p_red_01 = plot(t_red_01, red_01);
p_red_01.LineStyle = "-.";
p_red_01.LineWidth = 1.5;
p_red_01.Color = "r";
p_red_01.Marker = "s";
p_red_01.MarkerSize = 8;
p_red_01.MarkerEdgeColor = "r";
p_red_01.MarkerFaceColor = "b";
p_red_01.MarkerIndices = 1 : 5 : length(red_01);

% 设置轴属性
ax = gca;
yyaxis left % 修改左侧轴属性必不可少
ax.FontName = "Arial";
ax.FontSize = 10;
ax.Box = "on";
ax.XColor = "k";
ax.YColor = "r";
ax.XLim = [-0.5ceil(max(t_red_01))];
ax.YLim = [floor(min(red_02)), 1.5];

ax.XMinorTick = "on";
ax.YMinorTick = "on";
ax.XMinorGrid = "on";
ax.YMinorGrid = "on";
ax.MinorGridLineStyle = ":";

ax.XAxis.TickLabelFormat = "%.1f";
ax.YAxis(1).TickLabelFormat = "%.1f"% 修改左侧轴属性必不可少

% 设置轴标题
xlb = xlabel("$$\hat{y}$$");
xlb.FontSize = 16;
xlb.Interpreter = "latex";

ylb = ylabel("$$S_{\rm{D}}/S_{\rm{L}}$$");
ylb.FontSize = 14;
ylb.Interpreter = "latex";

hold off

yyaxis right
hold on

p_blue_01 = plot(t_blue_01, blue_01);
p_blue_01.LineStyle = "-";
p_blue_01.LineWidth = 1.5;
p_blue_01.Color = "b";
p_blue_01.Marker = "+";
p_blue_01.MarkerSize = 6.5;
p_blue_01.MarkerEdgeColor = "k";
p_blue_01.MarkerIndices = 1 : 5 : length(blue_01);

p_blue_02 = plot(t_blue_02, blue_02);
p_blue_02.LineStyle = "-";
p_blue_02.LineWidth = 1.5;
p_blue_02.Color = "b";
p_blue_02.Marker = "x";
p_blue_02.MarkerSize = 6.5;
p_blue_02.MarkerEdgeColor = "k";
p_blue_02.MarkerIndices = 1 : 5 : length(blue_02);

hold off

% 设置轴属性
ax = gca;
yyaxis right
ax.YColor = "b";
ax.YLim = [-0.5*10^43*10^4];
ax.YAxis(2).TickLabelFormat = "%.1f";

% 设置轴标题
ylb = ylabel("$$K_{\rm{S}}[1/s]$$");
ylb.FontSize = 14;
ylb.Interpreter = "latex";

% 设置图例
lgd = legend("$$V_{\rm{in}}=6 \rm{m/s}$$""$$V_{\rm{in}}=6 \rm{m/s} (\rm{S})$$");
lgd.FontName = "Arial";
lgd.FontSize = 11;
lgd.Location = "northeast";
lgd.TextColor = "k";
lgd.Box = "on";
lgd.NumColumns = 1;
lgd.Interpreter = "latex";

欢迎讨论和纠错。

分类:

工具介绍

标签:

绘画

作者介绍

Hao B.
V1