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 visualizzazione (ultimi 30 giorni)
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')

Risposte (1)

Anshika Chourasia
Anshika Chourasia il 23 Giu 2022
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 .

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by