Bar figure helps with group on the x-axis
4 次查看(过去 30 天)
显示 更早的评论
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]
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
0 个评论
回答(1 个)
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'};
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!