How can I plot this curve ?

조회 수: 1 (최근 30일)
Mallouli Marwa
Mallouli Marwa 2022년 8월 6일
편집: Image Analyst 2022년 8월 6일
Hi
How can I plot this curve ?
  댓글 수: 3
Mallouli Marwa
Mallouli Marwa 2022년 8월 6일
Thanks, how can I plot this bar
Adam Danz
Adam Danz 2022년 8월 6일
Use bar

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

채택된 답변

Image Analyst
Image Analyst 2022년 8월 6일
편집: Image Analyst 2022년 8월 6일
Use bar, xlabel, ylabel, title, and xticklabels. Use text to add text to other places, like atop the bars.
fontSize = 18;
% Define data.
data = [109, 70, 76, 85, 26];
% Define colors
purple = [153, 153, 255] / 255;
grayBackground = [192, 192, 192] / 255;
bar(data, 'BarWidth', 0.4, 'FaceColor',purple);
ax = gca;
ax.Color = grayBackground;
grid on;
xlabel('annees', 'FontSize',fontSize);
ylabel('Hueres (Eq. TD)', 'FontSize',fontSize)
title('Services 2001 - 2006 (366 H Eq. TD)', 'FontSize',fontSize)
xticklabels({ ...\
'2001-2002',...
'2002-2003',...
'2003-2004',...
'2004-2005',...
'2005-2006'
})
% Put labels atop the bars.
for k = 1 : numel(data)
str = sprintf('%d', data(k));
xt = k;
yt = data(k);
text(xt, yt, str, 'Color','k', ...
'VerticalAlignment','bottom', 'HorizontalAlignment','center', ...
'FontSize', fontSize, 'FontWeight', 'bold');
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by