yyaxis plots ignoring plotting commands or even changes the command unprompted
显示 更早的评论
The following script plots 2 curves on the left axis and 1 curve on the right axis as shown below. Each curve has its own error curves with the middle region filled in. I would expect the bounding curves to be green, have thickness of 2, and be solid curves, but they are only 0.5 thickness, black, and most strangely, the lower bound of temperature is plotted as dash. Any ideas why this might happen?
x2 = [time; flipud(time)];
f = figure;
f.Position = [616 601 1006 645];
hold on;
ax = gca;
ax.FontSize = 16;
ax.YColor = 'k';
plot(time,alpha_phase_UB,'g-','LineWidth',2,'HandleVisibility','off');
plot(time,alpha_phase_LB,'g-','LineWidth',2,'HandleVisibility','off');
inBetween = [alpha_phase_UB;flipud(alpha_phase)];
inBetween2 = [alpha_phase_LB;flipud(alpha_phase)];
fill(x2,inBetween,'g','FaceAlpha',0.5,'HandleVisibility','off');
fill(x2,inBetween2,'g','FaceAlpha',0.5,'HandleVisibility','off');
plot(time,alpha_phase,'r-','LineWidth',3);
plot(time,beta_phase_UB,'g-','LineWidth',2,'HandleVisibility','off');
plot(time,beta_phase_LB,'g-','LineWidth',2,'HandleVisibility','off');
inBetween = [beta_phase_UB;flipud(beta_phase)];
inBetween2 = [beta_phase;flipud(beta_phase_LB)];
fill(x2,inBetween,'g','FaceAlpha',0.5,'HandleVisibility','off');
fill(x2,inBetween2,'g','FaceAlpha',0.5,'HandleVisibility','off');
plot(time,beta_phase,'b-','LineWidth',3);
xlabel('Time (s)','FontSize',18);
ylabel('Phase fraction','FontSize',18);
ylim([0 1]);
% figure;
% hold on;
yyaxis right;
ax = gca;
ax.FontSize = 16;
ax.YColor = 'k';
colororder('default');
plot(time,temperature_UB,'g-','LineWidth',2,'HandleVisibility','off');
plot(time,temperature_LB,'g-','LineWidth',2,'HandleVisibility','off');
inBetween = [temperature_UB;flipud(temperature)];
inBetween2 = [temperature;flipud(temperature_LB)];
fill(x2,inBetween,'g','FaceAlpha',0.5,'HandleVisibility','off');
fill(x2,inBetween2,'g','FaceAlpha',0.5,'HandleVisibility','off');
plot(time,temperature,'k-','LineWidth',3);
ylabel('Temperature (^oC)','FontSize',18);
ylim([0 1200]);
legend('Alpha','Beta','Temperature','Location','northeast','FontSize',16);
legend boxoff;

1 个评论
the cyclist
2023-7-24
Can you upload the data? You can use the paper clip icon in the INSERT section of the toolbar.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
