How to label each bar in a subplot?
2 views (last 30 days)
Show older comments
Hello all. Is there a way to label each bar in a bar plot when used in subplot. I tried with same code as used for normal bar chart, but wasn't able to find the solution. Your help is appreciated.
For normal bar chart
f=figure;
bar(xval2,per_cond1,0.4)
labels=[70.2,19.8,10];
text(xval2, per_cond1, cellstr(num2str(labels)), 'VerticalAlignment','bottom', ...
'HorizontalAlignment','center')
But the same when used for subplot, It shows error
subplot(2,2,i),bar(xval2,combined_graph_100m(:,2),0.4)
labels=[70.8,19.2,10];
text(xval2, combined_graph_100m, cellstr(num2str(labels)), 'VerticalAlignment','bottom', ...
'HorizontalAlignment','center')
But there is an error popping up which says
??? Error using ==> text
Value must be a column or row vector
0 Comments
Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!