Bar figure helps with group on the x-axis

조회 수: 4 (최근 30일)
David
David 2022년 8월 25일
편집: Voss 2022년 8월 26일
Hello everyone, I need help with grouping my data, where the central value on the x-axis is the corresponding number, not approximations.
x = [1.2132312 5.3413413212];
vals = [1.12234 1.34234 0.52342741238 2.4132213 3.1231232 5.123123 8.123123;5.793371156 10.506158125 1.23213 1.3123 1.5 1.5 1.5]
vals = 2×7
1.1223 1.3423 0.5234 2.4132 3.1231 5.1231 8.1231 5.7934 10.5062 1.2321 1.3123 1.5000 1.5000 1.5000
b = bar(x,vals,'grouped');
For example, the group of 7 bars that comes out below only the number 1.2132312 and for the other set the number 5.3413413212

답변 (1개)

Voss
Voss 2022년 8월 26일
편집: Voss 2022년 8월 26일
Like this?
x = [1.2132312 5.3413413212];
vals = [1.12234 1.34234 0.52342741238 2.4132213 3.1231232 5.123123 8.123123;5.793371156 10.506158125 1.23213 1.3123 1.5 1.5 1.5];
b = bar(x,vals,'grouped');
set(gca(),'XTick',x)
Or this?
b = bar(x,vals,'grouped');
ax = gca();
ax.XTick = x;
ax.XAxis.TickLabelFormat = '%.10f';
Or this?
b = bar(x,vals,'grouped');
ax = gca();
ax.XTick = x;
ax.XTickLabel = {'1.2132312' '5.3413413212'};

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by