How can I change the appearance of the error bars?

조회 수: 46 (최근 30일)
Max Behr
Max Behr 2020년 6월 17일
답변: Prince Sachdeva 2020년 6월 19일
Hello,
I am trying to change the appearance of the errorbars not the line itself. This is my code and it only changes the style of the line, not the style of the errorbars :
errorbar(x,b,zeros(size(b_err)),b_err,'--o','LineWidth',1,'Markersize',3)
I would like to change the style and the colour of the errorbars, too.
How can I do it?
Thank you.

채택된 답변

Prince Sachdeva
Prince Sachdeva 2020년 6월 19일
Hi, I think when you change the colour property, it applies for both the line and the error as shown in the below code:
x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
err = 5*randn(size(y));
errorbar(x,y, err, '-or','LineWidth',2,'Markersize',3)
To apply different colour for error lines, you can code it as follows:
x = 1:10:100;
y = [20 30 45 40 60 65 80 75 95 90];
plot(x, y, '-.','LineWidth',1);
hold on;
err = 5 * randn(size(y));
errorbar(x, y, err, 'or', 'LineWidth', 2, 'Markersize', 3)
hold off

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Errorbars에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by