Different error bar color than the plot

조회 수: 196 (최근 30일)
Zeynab Mousavikhamene
Zeynab Mousavikhamene 2019년 10월 31일
댓글: Adam Danz 2022년 11월 18일
How can I set the error bar's color, thickness in the plot?
As you can see the error bar has the same color with the plot. How can I set the error bar color black and lower thickness?
the code I am using for this figure:
col = jet(length(KsTable.k_name));
errorbar(xy.xy1,abs(xy.xy2),xy.xy3,'-rs','Color',col(jjj,:),'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor','r',...
'MarkerSize',5)

답변 (1개)

Adam Danz
Adam Danz 2019년 10월 31일
편집: Adam Danz 2019년 11월 1일
You can plot the main line and the error bars separately. Here's a demo that plots the main line first and then the errorbars. If you want the errorbars under the main line, plot the errorbars first.
x = 0:.2:1;
y = x.^2;
err = y./5;
plot(x,y,'ro-')
hold on % <--Put this outside of your loop)
eb = errorbar(x,y,err,'LineStyle','none', 'Color', 'k','linewidth', 2);
  댓글 수: 8
Garima Singh
Garima Singh 2022년 11월 18일
How can I get filled markers here, instead of empty?

댓글을 달려면 로그인하십시오.

카테고리

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