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 Center および File ExchangeLine Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by