I have the horizontal legend for x-axis as you see in the attached graphics. But in this way numbers are hard to see. I would like to set the legend to be vertical to improve readability. Please advise.

 채택된 답변

Star Strider
Star Strider 2018년 4월 5일

0 개 추천

See if you can use the 'XTickLabelRotation' (link) ‘axes’ property. (I do not remember when this option first appeared. I believe it was R2015b.)

댓글 수: 4

Would you explain how it works in the following example?
w=0:0.05:1;
ncount1 = histc(x(:,1),w);
relativefreq1=ncount1/NSamples;
ncount2 = histc(x(:,2),w);
relativefreq2=ncount2/NSamples;
ncount3 = histc(x(:,3),w);
relativefreq3=ncount3/NSamples;
figure (4)
plot(w, relativefreq1)
hold on
plot(w, relativefreq2,'LineWidth',1.0)
hold on
plot(w, relativefreq3,'LineWidth',1.5)
legend('Data1','Data2','Data')
title('Distribution of Data')
xlabel('Data')
ylabel('Frequency')
xlim([min(w) max(w)])
set(gca, 'xtick', w)
Tweak the last line to be:
set(gca, 'xtick', w, 'XTickLabelRotation',90)
alpedhuez
alpedhuez 2018년 4월 5일
Thank you.
Star Strider
Star Strider 2018년 4월 5일
As always, my pleasure.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

태그

질문:

2018년 4월 5일

댓글:

2018년 4월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by