How to plot a Bar Graph without a uniform spacing on the horizontal axis

조회 수: 3 (최근 30일)
Hello, suppose I have a bar graph where I am testing some data with How can I have these four values spaced equally on the horizotnal axis?

채택된 답변

KSSV
KSSV 2021년 5월 10일
편집: KSSV 2021년 5월 10일
You can plot the values by index and show the respective values uisng text.
Example:
x = [5 10 100 1000] ;
y = rand(size(x)) ;
bar(y)
text(1:length(x),y,num2str(x'),'vert','bottom','horiz','center');
Or, use xticklabels and show the values at the x-axes.
Example:
x = [5 10 100 1000] ;
y = rand(size(x)) ;
bar(y)
xticklabels(x)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by