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!
