how to plot different horizontal lines over each group of bar plot
Afficher commentaires plus anciens
Réponse acceptée
Plus de réponses (1)
Here's a demo -
%Random data
mat = randi([11 19], 4, 6);
%Bar plot
b = bar(mat);
hold on
%Get the x-coordinates of each group (center of each bar)
%Each column represents the x-coordinates of each bar group
x = vertcat(b.XEndPoints)
%Get the coordinates of the end points
x = x([1 end],:).'
plot(x, [5 5], 'LineWidth', 2.5, 'Color', 'k');
hold off
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





