How do i make a specific thing on a bar graph

1 vue (au cours des 30 derniers jours)
Robert Flynn
Robert Flynn le 15 Mai 2020
Modifié(e) : Mehmed Saad le 15 Mai 2020
Sorry for the unspecific title I don't know the name of the thing I need help creating in matlab, as such I can't look it up online. Could someone please tell me what the lines circled in Red are called and how I would add them to a bar graph? thank you for your help!

Réponse acceptée

Mehmed Saad
Mehmed Saad le 15 Mai 2020
Modifié(e) : Mehmed Saad le 15 Mai 2020
You can use line for that purpose. See this link
You can also use errorbar
V = [8 18 32];% Bar Value
x = [1.5 2.5 2];% errorbar x cord
y= [25 37 45];% errorbar y cord
e = [0.5 0.5 1];% errorbar error
p_val = {'p=0.037','p<0.0001','p<0.0001'};% strings
figure,bar(V,'LineWidth',1.5,'FaceColor',[0.7843 0.7843 0],'BarWidth',0.6)
ylim([0 50]),xlim([0.5 3.5]);
hold on,errorbar(x,y,e,'horizontal','LineWidth',2,'Color','k','LineStyle','none')
ax =gca;
text(x,y,p_val,'BackgroundColor',get(gca,"Color"),'HorizontalAlignment','center')
set(ax,'Linewidth',2,'FontSize',15,'FontWeight','bold','Ytick',0:10:40,'XTickLabel',{'A','B','C'})

Plus de réponses (0)

Catégories

En savoir plus sur Errorbars dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by