How can I display stacked, logarithmic bar plots in MATLAB?

1 view (last 30 days)
I am trying to create stacked bar plots using a logarithmic scale. However, the following line of code returns a cell array:
vert=get(hb,'vertices');
This will cause an error on the next line:
vert(vert==0) = bv;

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 31 Aug 2010
Each set of "stacked" bars is a single patch object, and the variable returned from BAR will be a vector of handles for those objects. The variable "vert" contains a cell array because each cell contains the vertices for the corresponding patch object. It is necessary to change the properties for each patch object.
for n = 1:numel(hb),
vert=get(hb(n),'vertices');
vert(vert==0) = bv;
set(hb(n),'vertices',vert);
end

More Answers (0)

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!