How to insert a graph inside another graph?
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!