legend text size changing while ticklabel size changing

2 ビュー (過去 30 日間)
Roger
Roger 2015 年 5 月 15 日
コメント済み: Roger 2015 年 5 月 16 日
i just want to change the size of xticklabel not the legend text size , but this did not work. They all changed.
set(gca,'xticklabel', strsplit(num2str(10:14),' '),'fontsize',12)

回答 (1 件)

Joseph Cheng
Joseph Cheng 2015 年 5 月 15 日
what is happening is that you're setting all font sizes to 12. I haven't figure out how to set just the xticks to 12 but you can reset the legend like the code below
figure1 = figure;
% Create axes
axes1 = axes('Parent',figure1);
box(axes1,'on');
hold(axes1,'all');
set(axes1,'xticklabel', strsplit(num2str(10:14),' '),'fontsize',12)
% Create multiple lines using matrix input to plot
plot1 = plot(randi(4,10));
% Create legend
legend1 = legend(axes1,'show');
set(legend1,'FontSize',8);
  2 件のコメント
Joseph Cheng
Joseph Cheng 2015 年 5 月 15 日
ok did some more digging. you cannot set ticklabel font size separately. you'll have to adjust the fontsize and then reset the legend size.
Roger
Roger 2015 年 5 月 16 日
thanks, not a good way ,i think

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by