How do I automatically annotate a 2D bar graph with corresponding p-values for each bar?
Mostrar comentarios más antiguos
I would like to display the p-values on top of a bar graph.
Here's what I have:
y = [1 2 3; 4, 4, 5; 6, 7, 6];
p = rand(3,3)
figure
bar(y)
p_flat = reshape(p', 1, 9);
y_flat = reshape(y', 1, 9);
for ii = 1:9
text(ii, p_flat(ii)+2, ['p=' num2str(p_flat(ii))])
end
The problem is that only three p-values are being displayed, and they are in the wrong spot.
How do I make it so that the p-values are on top of the correct bar?
Thanks!
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Convert Image Type 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!