how to merge two figures
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Good morning sir
i have attached two figures.i requesting you please help me how to merge two figures
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/991430/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/991435/image.jpeg)
0 Kommentare
Antworten (3)
Stephan
am 9 Mai 2022
Have a look at: yyaxis
2 Kommentare
Pavl M.
am 26 Nov. 2024
Bearbeitet: Pavl M.
am 26 Nov. 2024
How to license codes?
Better than Creative Commons?
Have you already embedded codes in the .fig files?
clc
clear all
close all
f1 = openfig('https://uk.mathworks.com/matlabcentral/answers/uploaded_files/991995/figure(1).fig','invisible')
f2 = openfig('https://uk.mathworks.com/matlabcentral/answers/uploaded_files/992000/figure(2).fig','invisible')
o1=findobj(f1,'Type','line');
x_f1=get(o1,'xdata');
y_f1=get(o1,'ydata');
o2=findobj(f2,'Type','line');
x_f2=get(o2,'xdata');
y_f2=get(o2,'ydata');
figure
yyaxis left
plot(x_f1,y_f1)
hold on
yyaxis right
plot(x_f2,y_f2)
hold off
title('Combined figures')
%Constructed by
%https://independent.academia.edu/PMazniker
%+380990535261, https://join.skype.com/invite/oXnJhbgys7oW
%https://diag.net/u/u6r3ondjie0w0l8138bafm095b
%https://github.com/goodengineer
%https://orcid.org/0000-0001-8184-8166
%https://willwork781147312.wordpress.com/portfolio/cp/
%https://www.youtube.com/channel/UCC__7jMOAHak0MVkUFtmO-w
%https://nanohub.org/members/130066
%https://pangian.com/user/hiretoserve/
%https://substack.com/profile/191772642-paul-m
Pavl M.
am 26 Nov. 2024
Bearbeitet: Pavl M.
am 26 Nov. 2024
How to license codes?
My codeworks programme are on Specific ECommerce License.
Have you already embedded codes in the .fig files?
clc
clear all
close all
%Since there are a few plots in figure with y axis "Infected", need
%to extract all children from it (object oriented, standard GUI feature
%like in Qt framework, using the class getters...doable...just need
%more time and investment to finish the yet commented codes.
open https://uk.mathworks.com/matlabcentral/answers/uploaded_files/992000/figure(1).fig;
fig = get(groot, 'CurrentFigure' )
hFigAxes = get(fig,'Children')
h1Plot = get(hFigAxes,'Children')
x1Data = get(h1Plot,'XData')
y1Data = get(h1Plot,'YData')
close(fig)
f2 = openfig('https://fr.mathworks.com/matlabcentral/answers/uploaded_files/991995/figure(2).fig','invisible')
o2=findobj(f2,'Type','line');
x_f2=get(o2,'xdata');
y_f2=get(o2,'ydata');
figure
yyaxis left
plot(x1Data{1},y1Data{1})
hold on
plot(x1Data{2},y1Data{2})
hold on
yyaxis right
plot(x_f2,y_f2)
hold off
title('Combined Figures')
%Constructed by
%https://independent.academia.edu/PMazniker
%+380990535261, https://join.skype.com/invite/oXnJhbgys7oW
%https://diag.net/u/u6r3ondjie0w0l8138bafm095b
%https://github.com/goodengineer
%https://orcid.org/0000-0001-8184-8166
%https://willwork781147312.wordpress.com/portfolio/cp/
%https://www.youtube.com/channel/UCC__7jMOAHak0MVkUFtmO-w
%https://nanohub.org/members/130066
%https://pangian.com/user/hiretoserve/
%https://substack.com/profile/191772642-paul-m
0 Kommentare
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!