How do i make a specific thing on a bar graph

1 次查看(过去 30 天)
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!

采纳的回答

Mehmed Saad
Mehmed Saad 2020-5-15
编辑:Mehmed Saad 2020-5-15
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'})

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Errorbars 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by