how to merge two figures
조회 수: 5 (최근 30일)
이전 댓글 표시
Good morning sir
i have attached two figures.i requesting you please help me how to merge two figures


댓글 수: 0
답변 (3개)
Stephan
2022년 5월 9일
Have a look at: yyaxis
댓글 수: 2
Mr. Pavl M.
2024년 11월 26일
편집: Mr. Pavl M.
2024년 11월 26일
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
Mr. Pavl M.
2024년 11월 26일
편집: Mr. Pavl M.
2024년 11월 26일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!