Bar graphs don't group bars if there is only one group in the data
7 views (last 30 days)
I have a lot of bar graphs to plot. The bars must be grouped into pairs. If the number of pairs is one, then grouping doesn't seem to work:
% Artificial data: Two vertical vectors of height 3
% Correct grouping into pairs
% NO grouping :(
Is there any way to force barh to group consistently? I want each column of "x" to form a series, even if it is a series of 1. So x(1,:) forms two series, only 1 bar each. In the grouped bar chart, it should form one group of two bars, each bar with a different colour (just like each group on the left subplot). In contrast, the right subplot shows that it forms a single series of two bars (or a single series of two groups, each containing one bar). They also have separate tick lables, which bars in the same group should not.
I am using Matlab 2022a.