how to plot different horizontal lines over each group of bar plot
Mostrar comentarios más antiguos
Respuesta aceptada
Más respuestas (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
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





