Ylim is not working
38 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yaser Khojah
el 25 de Mzo. de 2019
Comentada: Yaser Khojah
el 25 de Mzo. de 2019
I have tried to inlcude a common and fixed Y-axis and X-axis for all the figures but it is working. Can you please help.
figure
N_F =1;
subplot(3,1,1);
idx_1 = MaT_All(:,1) == Median_All(1) & MaT_All(:,2) ~= Median_All(2) & MaT_All(:,3) ~= Median_All(3) & MaT_All(:,4) ~= Median_All(4)...
& MaT_All(:,5) ~= Median_All(5) & MaT_All(:,6) ~= Median_All(6) & MaT_All(:,7) ~= Median_All(7) & MaT_All(:,8) ~= Median_All(8);
Mat_1 = MaT_All(idx_1,:);
scatter(MaT_All(idx_1,18),MaT_All(idx_1,17)); hold on;
title(sprintf('Impact of r* on Field %d',N_F))
xlabel('Risk ($B)')
ylabel('E(NPV) ($B)')
legend(sprintf('Medain Only of Field %d',N_F))
ylim([-50 50])
N_F =2;
subplot(3,1,2);
idx_2 = MaT_All(:,1) ~= Median_All(1) & MaT_All(:,2) == Median_All(2) & MaT_All(:,3) ~= Median_All(3) & MaT_All(:,4) ~= Median_All(4)...
& MaT_All(:,5) ~= Median_All(5) & MaT_All(:,6) ~= Median_All(6) & MaT_All(:,7) ~= Median_All(7) & MaT_All(:,8) ~= Median_All(8);
Mat_2 = MaT_All(idx_2,:);
scatter(MaT_All(idx_2,18),MaT_All(idx_2,17)); hold on;
title(sprintf('Impact of r* on Field %d',N_F))
xlabel('Risk ($B)')
ylabel('E(NPV) ($B)')
legend(sprintf('Medain Only of Field %d',N_F))
ylim([-50 50])
N_F =8;
subplot(3,1,3);
idx_8 = MaT_All(:,1) ~= Median_All(1) & MaT_All(:,2) ~= Median_All(2) & MaT_All(:,3) ~= Median_All(3) & MaT_All(:,4) ~= Median_All(4)...
& MaT_All(:,5) ~= Median_All(5) & MaT_All(:,6) ~= Median_All(6) & MaT_All(:,7) ~= Median_All(7) & MaT_All(:,8) == Median_All(8);
Mat_8 = MaT_All(idx_8,:);
scatter(MaT_All(idx_8,18),MaT_All(idx_8,17)); hold on;
title(sprintf('Impact of r* on Field %d',N_F))
xlabel('Risk ($B)')
ylabel('E(NPV) ($B)')
legend(sprintf('Medain Only of Field %d',N_F))
ylim([-50 50])
0 comentarios
Respuesta aceptada
Adam
el 25 de Mzo. de 2019
Use explicit axes handles for plotting instructions and instructions like hold, ylim, xlim. i.e.
hAxes(1) = subplot(3,1,1);
scatter( hAxes(1),... );
ylim( hAxes(1),... );
...
hAxes(2) = subplot(3,1,2);
...
You may also find
doc linkaxes
useful if you want your axes to all have the same limits. If you store your axes handles in an array as shown above then you can simply replace all the individual ylim instructions with
linkaxes( hAxes, 'y' )
ylim( hAxes(1), [-50 50] )
Más respuestas (0)
Ver también
Categorías
Más información sobre Axis Labels 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!