writing the bar chart value

조회 수: 6 (최근 30일)
Lilya
Lilya 2016년 2월 13일
댓글: Lilya 2016년 2월 13일
Hi all,
the following chart describes the problem in displaying the bar value why does it not appear as a single value for each one?
thank you for help
  댓글 수: 2
Star Strider
Star Strider 2016년 2월 13일
What code did you write to create it?
Lilya
Lilya 2016년 2월 13일
편집: dpb 2016년 2월 13일
y = [R2_Plm; R2_Tlm; R2_Txlm; R2_Tylm; R2_Wlm; R2_PTlm]';
x=1:6;
bar(y,0.4)
ylim([0 1.2])
Labels = {'P', 'T', 'Tx', 'Ty','Txy', 'P and T'};
set(gca, 'XTick', x, 'XTickLabel', Labels);
text(x',y',num2str(y),...
'HorizontalAlignment','center','VerticalAlignment','bottom')

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

채택된 답변

Image Analyst
Image Analyst 2016년 2월 13일
You need to do each label one at a time. Use this:
bar(y,0.4)
ylim([0 1.2])
Labels = {'P', 'T', 'Tx', 'Ty','Txy', 'P and T'};
set(gca, 'XTick', x, 'XTickLabel', Labels);
for k = 1 : length(x)
text(x(k)',y(k)',num2str(y(k)),...
'HorizontalAlignment','center','VerticalAlignment','bottom')
end
grid on;

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by