How to insert a graph inside another graph?

13 ビュー (過去 30 日間)
Vishnuvardhan Naidu Tanga
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]')
Vishnuvardhan Naidu Tanga
Vishnuvardhan Naidu Tanga 2022 年 10 月 6 日

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by