Clear Filters
Clear Filters

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?

2 views (last 30 days)
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);
ax1.XColor = 'r';
ax1.YColor = 'r';
ax2 = axes(t);
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')

Answers (1)

Anshika Chourasia
Anshika Chourasia on 23 Jun 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: .


Find more on Line Plots in Help Center and File Exchange


Community Treasure Hunt

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

Start Hunting!