Hello, Johnny
I tried simulating you code and I am able to see the colorbar for the individual subplots. The figure below shows that output that I get when I run my code
As you can see, the colorbar appears adjacent to all the constituent subplots
Below is the code I used to get the output
[X,Y,Z] = peaks;
for ij = 1:4
if ij ==1
a = 5*rand(1,20);
b = 5*rand(1,20);
c = 1:5;
d = 5*rand(1,20);
e = 5*rand(1,20);
subplot(4,1,1)
colorbar
yline(2.5, '--', 'Source')
hold on
quiver(a,b,d,e,1);
hold on
contour(X,Y,Z,20)
title(sprintf('Contour map of the fluid thickness at time = 20 of max time'))
subtitle(sprintf('Incline angle of 10 degrees & an initial source fluid thickness of 20'))
xlabel('Transverse Flow Dispersion (m)')
ylabel('Flow length(m)')
elseif ij ==2
a = 5*rand(1,20);
b = 5*rand(1,20);
c = 1:5;
d = 5*rand(1,20);
e = 5*rand(1,20);
subplot(4,1,2)
yline(2.5, '--', 'Source')
hold on
quiver(a,b,d,e,1);
hold on
contour(X,Y,Z,20)
title(sprintf('Contour map of the fluid thickness at time = 20 of max time'))
subtitle(sprintf('Incline angle of 10 degrees & an initial source fluid thickness of 20'))
xlabel('Transverse Flow Dispersion (m)')
ylabel('Flow length(m)')
colorbar
elseif ij ==3
a = 5*rand(1,20);
b = 5*rand(1,20);
c = 1:5;
d = 5*rand(1,20);
e = 5*rand(1,20);
subplot(4,1,3)
yline(2.5, '--', 'Source')
hold on
quiver(a,b,d,e,1);
hold on
contour(X,Y,Z,20)
title(sprintf('Contour map of the fluid thickness at time = 20 of max time'))
subtitle(sprintf('Incline angle of 10 degrees & an initial source fluid thickness of 20'))
xlabel('Transverse Flow Dispersion (m)')
ylabel('Flow length(m)')
colorbar
elseif ij ==4
a = 5*rand(1,20);
b = 5*rand(1,20);
c = 1:5;
d = 5*rand(1,20);
e = 5*rand(1,20);
subplot(4,1,4)
colorbar
yline(2.5, '--', 'Source')
hold on
quiver(a,b,d,e,1);
hold on
contour(X,Y,Z,20)
title(sprintf('Contour map of the fluid thickness at time = 20 of max time'))
subtitle(sprintf('Incline angle of 10 degrees & an initial source fluid thickness of 20'))
xlabel('Transverse Flow Dispersion (m)')
ylabel('Flow length(m)')
end
end
Please let me know if I am missing something or misinterpreting someting in your question
Here is a link to the MathWorks Documentation page for more information on the "colorbar" function
Thank You,
Gautam Murthy