I have 3 figures, each with 2 x-axis and 2 y-axis, and i want to compine all 3 in a way similar to subplot, can anyone help?

조회 수: 1 (최근 30일)
Each figure is created using the following code
T_density = density(:,1);
y_density = density(:,2);
T_st = surface_tension(:,1);
y_st = surface_tension(:,2);
x1 = T_density;
y1 = y_density;
x2 = T_st;
y2 = y_st;
t = tiledlayout(1,1);
ax1 = axes(t);
figure
plot(ax1,x1,y1,'-r')
ax1.XColor = 'r';
ax1.YColor = 'r';
ax2 = axes(t);
plot(ax2,x2,y2,'-k')
ax2.XAxisLocation = 'top';
ax2.YAxisLocation = 'right';
ax2.Color = 'none';
ax1.Box = 'off';
ax2.Box = 'off';
xlabel (ax1,'Temperature [K]')
xlabel (ax2,'Temperature [K]')
ylabel (ax1,'Desnity [kg/m^3]')
ylabel (ax2,'Surface Tension Coefficient')

답변 (1개)

Anshika Chourasia
Anshika Chourasia 2022년 6월 23일
Hi Sanad,
To create a configurable tiling of plots you can use the tiledlayout and nexttile functions.
For more information, refer the following link for combining multiple plots: https://www.mathworks.com/help/matlab/creating_plots/combine-multiple-plots.html .

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by