How to change ylabels in a for loop
5 次查看(过去 30 天)
显示 更早的评论
Hello everyone, I have a simple for loop to plot 7 different plots, but the ylabel should be different.
for k=1:7;
figure
bar(GAMMA_sta(k,:))
xlabel('Rock Types');
title( [ 'Statistics of Rocks', num2str(k)] );
end
Anyone knows how to change ylabel for each plot in a for loop please let me know. Thanks. My 7 plots should have 7 different ylabels.
0 个评论
采纳的回答
Walter Roberson
2012-5-14
For example,
ylabel(sprintf('Plot #%d', k))
It would be easier if you indicated how you want the different ylabel to look.
4 个评论
Walter Roberson
2012-5-14
Before loop:
ylabs = {'Mean', 'Std', '1st Moment', 'Allegro', 'Geraniums', 'Circularity', 'Disco'};
Inside loop:
ylabel(ylabs{k});
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!