How can I label each colorbar axis from a list, using subplot axis inside a for loop?

2 views (last 30 days)
I want to label each colorbar axis using a list l inside the for loop. Is there any way I can make it? Thanks.
[ha, pos]= tight_subplot(1,5,[.09 .085],[.165 .02],[.1 .045]);
for jj=1:5
axes(ha(jj));
l={'m12','m23','m13','m32', 'm33'};
x=load(sprintf('m%d1.dat',jj));
x1=scatter(x(:,2),x(:,3),[],x(:,4),'filled');
hold on
set(gca,'Fontsize',34,'LineWidth',2.0,'TickDir','in')
set(gca,'XMinorTick','on','YMinorTick','on')
set(gca,'XMinorTick','on','YMinorTick','on','Box','on')
set(gca,'TickLength',[0.04, 0.01])
c = colorbar;
set(c,'FontSize',40)
c.Label.String =('$\rm{D_{a_{l{jj}}}}$');
c.Label.Interpreter = 'latex';
caxis([min(x(:,4)) 1]);
% caxis auto
xlabel('A_{{m}}');
end
ylabel('M_{{m}}')

Accepted Answer

Walter Roberson
Walter Roberson on 13 Sep 2023
c.Label.String = "$\rm{D_{a_{" + l{jj} + "}}}$";

More Answers (0)

Categories

Find more on Colormaps 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!