How to zoom on a particular portion of the graph?

clc
clear
close all
A =[1 0.108 0.045 0.08 0.098
6 0.27 0.107 0.173 0.205
10 0.331 0.137 0.151 0.177
15 0.349 0.139 0.248 0.302
22 0.36 0.142 0.19 0.222
30 0.362 0.15 0.173 0.201
40 0.554 0.218 0.344 0.417
60 0.369 0.154 0.361 0.484
80 0.379 0.149 0.303 0.387
100 0.611 0.242 0.436 0.534
135 0.68 0.269 0.411 0.483
150 0.685 0.347 0.593 0.691
220 0.958 0.395 0.68 0.864
288 1.208 0.677 0.906 0.942
];
figure('Color','w')
plot(A(:,1),A(:,2:5))
legend('A','C','E', 'G')
xlim([0 300])
ylim([0 2])

 Respuesta aceptada

Sam Chak
Sam Chak el 7 de Mayo de 2022
After the xlim line, enter this:
p = get(gca, 'Position');
h = axes('Parent', gcf, 'Position', [p(1)+.06 p(2)+.45 p(3)-.5 p(4)-.5]);
plot(h, A(:,1), A(:,2:5));
set(h, 'Xlim', [40 120], 'Ylim', [0.1 0.7]);

6 comentarios

Thank you for your responce. But i get this error in 2015a version
Error using matlab.graphics.axis.Axes/get
There is no Position property on the Axes class.
Error in precision1 (line 23)
p = get(gca, 'Position ');
clc
clear
close all
A =[1 0.108 0.045 0.08 0.098
6 0.27 0.107 0.173 0.205
10 0.331 0.137 0.151 0.177
15 0.349 0.139 0.248 0.302
22 0.36 0.142 0.19 0.222
30 0.362 0.15 0.173 0.201
40 0.554 0.218 0.344 0.417
60 0.369 0.154 0.361 0.484
80 0.379 0.149 0.303 0.387
100 0.611 0.242 0.436 0.534
135 0.68 0.269 0.411 0.483
150 0.685 0.347 0.593 0.691
220 0.958 0.395 0.68 0.864
288 1.208 0.677 0.906 0.942
];
figure('Color','w')
plot(A(:,1),A(:,2:5))
legend('A','C','E', 'G')
xlim([0 300])
p = get(gca, 'Position ');
h = axes('Parent', gcf, 'Position', [p(1)+.06 p(2)+.45 p(3)-.5 p(4)-.5 ]);
plot(h, A(:,1), A(:,2:5 ));
set(h, 'Xlim', [40 120], 'Ylim', [0.1 0.7 ]);
Sam Chak
Sam Chak el 7 de Mayo de 2022
Bro, there is a space here:
Thank you. Can i make a circle on which data i have plot into a sub-plot?
Thank you for the link. if i add 5 variet in
A =[1 2.943 2.743 0.766 0.715 0.753]
what necessary chage i have to do in
h = axes('Parent', gcf, 'Position', [p(1)+.06 p(2)+.45 p(3)-.5 p(4)-.5 ]);
line?
I have tried it several times but it shows errror in matrix.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 7 de Mayo de 2022

Comentada:

el 7 de Mayo de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by