How to magnify the subplot inside the same plot in Matlab?
Mostrar comentarios más antiguos
figure
plot(round(1:100:end), DEAD_DBR(1:100:end),'r--o','LineWidth',2)
xlabel('Rounds')
ylabel('Number of Dead nodes')
title('Dead nodes')
hold on
plot(round(1:100:end), DEAD_DBR_N(1:100:end),'b-->','LineWidth',2)
legend('DBR' , 'DNAR')
grid on
axis([0 1401 0 250])
hold off

1 comentario
KALYAN ACHARJYA
el 8 de Mzo. de 2019
Please check here
Respuestas (1)
Image Analyst
el 8 de Mzo. de 2019
2 votos
See my attached demo to inset a plot within a plot. For the smaller plot you can just use the same data and change the axes range with xlim() and ylim().
4 comentarios
Junaid Qadir
el 12 de Mzo. de 2019
Image Analyst
el 12 de Mzo. de 2019
It's really no more complicated than your code. It basically just calls plot twice and axes() to set the location of the inset plot. Attach your data if you want me to do it with your DEAD_DBR signal.
Junaid Qadir
el 13 de Mzo. de 2019
Image Analyst
el 13 de Mzo. de 2019
See what I mean:
Error using plot
Not enough input arguments.
Error in test3 (line 2)
plot(round(1:100:end), DEAD_DBR(1:100:end),'r--o','LineWidth',2)
Even if we fixed the incorrect indexing,
figure
%DEAD_DBR = rand(1, 10000);
y = DEAD_DBR(1:100:end)
x = 1:length(y);
plot(x, y, 'r--o','LineWidth',2)
xlabel('Rounds')
ylabel('Number of Dead nodes')
title('Dead nodes')
DEAD_DBR is not defined in the code you gave.
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!