Would it also be possible to move the graph of head space pressure profile towards the centre rather than on the left?
How can I make it so that the title is at the top rather than where it is?
4 views (last 30 days)
Show older comments
% Concentrations in a batch reactor (CA, CB, CS, CD) (UA = 0)
p1 = uipanel('Position',[.1 .2 .8 .1]);
p1.Title = 'Cooling Water NOT Activated, UA = 0';
p1.TitlePosition = "centertop";
f1 = tiledlayout(p1,3,1,'TileSpacing','Loose');
axis equal
nexttile
plot(t,C_A,'g','LineWidth',1.2)
hold on
plot(t,C_B,'b','LineWidth',1.2)
plot(t,C_S,'r','LineWidth',1.2)
plot(t,C_D,'k','LineWidth',1.2)
hold off
grid on
grid minor
xlim([t0 t_max])
ylim([0 5.5])
legend('C_{A}','C_{B}','C_{S}','C_{D}');
xlabel('t / hrs');
ylabel('Concentration / molL^{-1}');
title({'Graph of Different Concentration',...
'Profiles in a Batch Reactor'})
% Temperature in a Batch Reactor (UA = 0)
nexttile
plot(t,T,'r','LineWidth',1.2)
grid on
grid minor
xlim([t0 t_max])
ylim([T0 550])
legend('T');
xlabel('t / hrs');
ylabel('Temperature / K');
title({'Graph of Temperature Profile',...
'in a Batch Reactor'})
% Head Space Pressure in a Batch Reactor (UA = 0)
nexttile
plot(t,P,'b','LineWidth',1.2)
grid on
grid minor
xlim([t0 t_max])
ylim([0 50])
legend('P');
xlabel('t / hrs');
ylabel('Head Space Pressure / atm');
title({'Graph of Head Space Pressure',...
'Profile in a Batch Reactor'})
3 Comments
DGM
on 4 Jan 2022
Which title? There are titles for each of the tiles, which are already at the top of each tile. There is a title for a uipanel, which is also already at the top of the uipanel. I assume the uipanel isnt supposed to be where it is, but it's unclear where you would even put a uipanel in this figure.
If you're looking for a title over the entire figure, maybe sgtitle() is what you're after?
Accepted Answer
DGM
on 4 Jan 2022
Edited: DGM
on 4 Jan 2022
If you're trying to get the tiles to show up in the uipanel, maybe this is a start:
x = rand(1,20);
mg = 0.05;
p1 = uipanel('Position',[mg mg [1 1]-mg*2]);
p1.Title = 'Cooling Water NOT Activated, UA = 0';
p1.TitlePosition = "centertop";
f1 = tiledlayout(p1,2,2,'TileSpacing','Loose');
ax = nexttile(f1);
plot(ax,x) % placeholder
xlabel('t / hrs');
ylabel('Concentration / molL^{-1}');
title({'Title 1'})
ax = nexttile(f1);
plot(ax,x)
xlabel('t / hrs');
ylabel('Concentration / molL^{-1}');
title('Title 2')
ax = nexttile(f1,[1 2]);
plot(ax,x)
xlabel('t / hrs');
ylabel('Concentration / molL^{-1}');
title('Title 3')
3 Comments
DGM
on 9 Jan 2022
You're going to have to try to move the plots and legends around to make room. You might be able to get a bit more space by playing with the 'TileSpacing' property, but I doubt it'll save much.
x = linspace(0,1,10);
y = x.^[1; 2; 3; 4];
mg = 0.05;
p1 = uipanel('Position',[mg mg [1 1]-mg*2]);
p1.Title = 'Cooling Water NOT Activated, UA = 0';
p1.TitlePosition = "centertop";
f1 = tiledlayout(p1,2,2,'TileSpacing','Tight');
ax = nexttile(f1,[1 2]);
plot(ax,x,fliplr(y)) % placeholder
xlabel('t / hrs');
ylabel('Concentration / molL^{-1}');
title({'Title 1'})
hl = legend({'aaa','bbb','ccc'},'location','northeast');
hl.Orientation = 'horizontal';
ax = nexttile(f1,3);
plot(ax,x,y(2,:))
xlabel('t / hrs');
ylabel('Concentration / molL^{-1}');
title('Title 2')
legend('ddd','location','northwest')
ax = nexttile(f1,4);
plot(ax,x,y(3,:))
xlabel('t / hrs');
ylabel('Concentration / molL^{-1}');
title('Title 3')
legend('ddd','location','northwest')
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!