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

141 visualizaciones (últimos 30 días)
Edoardo Bologna
Edoardo Bologna el 20 de Abr. de 2017
Editada: Andrew Newell el 20 de Abr. de 2017
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

Respuesta aceptada

Andrew Newell
Andrew Newell el 20 de Abr. de 2017
Editada: Andrew Newell el 20 de Abr. de 2017
Use ylim right after yyaxis right.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by