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

1 回表示 (過去 30 日間)
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}}')

採用された回答

Walter Roberson
Walter Roberson 2023 年 9 月 13 日
c.Label.String = "$\rm{D_{a_{" + l{jj} + "}}}$";
  1 件のコメント
Anil
Anil 2023 年 9 月 13 日
Perfect! thanks. It works for
c.Label.String =l{jj};
but without formating text.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeColorbar についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by