How to magnify the subplot inside the same plot in Matlab?

조회 수: 4 (최근 30일)
Junaid Qadir
Junaid Qadir 2019년 3월 8일
댓글: Image Analyst 2019년 3월 13일
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개)

Image Analyst
Image Analyst 2019년 3월 8일
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
Junaid Qadir
Junaid Qadir 2019년 3월 13일
Sir dead_dbr is actually number of total nodes, which are 225 nodes.
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
Image Analyst
Image Analyst 2019년 3월 13일
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.

댓글을 달려면 로그인하십시오.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by