![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245870/image.png)
Different error bar color than the plot
196 ビュー (過去 30 日間)
古いコメントを表示
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245853/image.jpeg)
0 件のコメント
回答 (1 件)
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);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/245870/image.png)
参考
カテゴリ
Help Center および File Exchange で Errorbars についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!