Making a Plot inset?
Ältere Kommentare anzeigen
So this is my Code
% 1 Hz
i =1;
figure(1)
I plot my 4 lines in one plot
subplot(2,2,i)
hold on;
plot(Freq_0k4 {1,i}(1,:), Moment_0k4 {1,i}(:,1),'k');
plot(Freq_1k6 {1,i}(1,:), Moment_1k6 {1,i}(:,1),'r');
plot(Freq_3k2 {1,i}(1,:), Moment_3k2 {1,i}(:,1),'m');
plot(Freq_4k8 {1,i}(1,:), Moment_4k8 {1,i}(:,1),'b');
xlim([0 10]);
legend('0,4°','1,6°','3,2°','4,8°');
legend('boxoff');
xlim([0 10]);
grid on;
Then I would like to make an inset, where you have a kind of zoomed in section, to see which is above which line.
p = get(gca, 'Position');
h = axes('Parent', gcf, 'Position', [p(1)+0.05 p(2)+0.2 p(3)-0.25 p(4)-0.2]);
plot(h, Freq_0k4 {1,i}(1,:), Moment_0k4 {1,i}(:,1),'k');
plot(h, Freq_1k6 {1,i}(1,:), Moment_1k6 {1,i}(:,1),'r');
plot(h, Freq_3k2 {1,i}(1,:), Moment_3k2 {1,i}(:,1),'m');
plot(h, Freq_4k8 {1,i}(1,:), Moment_4k8 {1,i}(:,1),'b');
set(h, 'Xlim', [0.9 1.1], 'Ylim', [4 5.2]);
grid on;
hold off;
unfortunatly with this inset only the last 'blue' line is getting plotted.
Can anybody help me with this?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Exploration finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!