Why do plotting functions like bar or barh take a long time to execute?
Show older comments
I have a 1x600 vector of doubles, where each element represent the duration of a certain engineering process. I want to get a horizontal stacked bar graph which shows the duration of each process sequentially. For that I am using the following code
BHd --> 1x600 vector
BHd = [zeros(length(BHd),1), BHd];
figure(3)
barh(BHd', 'stacked');
However, I noticed that it takes a long time for barh function to run in this case (58.2 s). Are there any alternative ways of plotting the stacked bar graphs, that would take less time?
The plots should have the following format.

Btw, I am running MATLAB2017b on my computer
3 Comments
You can do more or less the same ting with lines, instead of patches. See here.
You just increase the line width, and it looks like a bar. You can also plot the edges as a continous line.
theblueeyeswhitedragon
on 9 Aug 2018
Accepted Answer
More Answers (0)
Categories
Find more on Discrete Data 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!