How do I set the limits on the secondary y axis?

조회 수: 141 (최근 30일)
Edoardo Bologna
Edoardo Bologna 2017년 4월 20일
편집: Andrew Newell 2017년 4월 20일
I would like to force my secondary Y axis to start from 0 rather than from 1.
figure('Position',[200, 200, 850, 400]);
yyaxis left
xlim([1 12])
P_8_area = area(ts,P_8,'EdgeColor','none');
P_8_area.FaceColor = ('k');
set(gca,'Color',[0.9 0.9 0.9]);
alpha(0.4)
xlabel('Time step')
ylabel('Power [kW]')
yyaxis right
Perm_1_8_plot = plot(ts,Perm_1_8,'-go','LineWidth',2);
xlabel('Time step')
ylabel('Permeate flow [m^3/h]')
hold on
yyaxis right
Perm_2_8_plot = plot(ts,Perm_2_8,'-r*','LineWidth',2);
xlabel('Time step')
ylabel('Permeate flow [m^3/h]')
yyaxis right
Perm_sw_8_plot = plot(ts,Perm_sw_8,'-b+','LineWidth',2);
xlabel('Time step')
ylabel('Permeate flow [m^3/h]')
legend([P_8_area,Perm_sw_8_plot,Perm_2_8_plot,Perm_1_8_plot],'Power',...
'Permeate flow with switching', 'Permeate flow 2 vessels','Permeate flow 1 vessel','Location','southwest')
hold off

채택된 답변

Andrew Newell
Andrew Newell 2017년 4월 20일
편집: Andrew Newell 2017년 4월 20일
Use ylim right after yyaxis right.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by