How to insert a graph inside another graph?

조회 수: 20 (최근 30일)
Vishnuvardhan Naidu Tanga
Vishnuvardhan Naidu Tanga 2022년 10월 6일
댓글: Vishnuvardhan Naidu Tanga 2022년 10월 6일
I am trying to insert a graph inside an another graph. Can some one tell me how to move the second plot to the empty space on left side and the titel is overlapping with the second graph. My code is as follows:
Z = readtable('Matlab.xlsx') ;
data = table2array(Z) ;
figure(1)
plot(data(:,1), data(:,2), 'ko', 'linewidth', 2);
hold on
plot(data(:,3), data(:,4), 'ks', 'linewidth', 2);
hold on
plot(data(:,5), data(:,6), 'k^', 'linewidth', 2);
hold on
plot(data(:,7), data(:,8), 'kv', 'linewidth', 2);
hold on
plot(data(:,9), data(:,10), 'K', 'linewidth', 2);
hold on
plot(data(:,11), data(:,12), 'kx', 'linewidth', 2);
hold off
ax1 = gca;
legend('P1', 'P2', 'P3','P4','P4', 'P6', 'Location', 'northeastoutside');
grid on
xlim([40 140])
xlabel('x');
ylabel('Y');
ax2 = axes('Position',[.7 .7 .2 .2]);
plot(data(:,13), data(:,14), 'k', 'linewidth', 2);
hold on
plot(data(:,15), data(:,16), 'kx','linewidth', 2);
hold off
grid on
xlim([0 40])
xlabel('x');
ylabel('y');
legend('P7', 'P8', 'Location', 'northeastoutside');
title('[Title on top]')
x0=12;
y0=2;
width=1200;
height=560;
set(gcf,'position',[x0,y0,width,height])
set(gcf,'PaperOrientation','landscape');
  댓글 수: 4
Walter Roberson
Walter Roberson 2022년 10월 6일
title(ax1, '[Title on top]')

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by