
plot3 error bars
조회 수: 29 (최근 30일)
이전 댓글 표시
Hi all, does anyone know how I might add an error bar to a data point along the Z axis for a plot3 plot?
댓글 수: 0
채택된 답변
Star Strider
2019년 5월 18일
The errorbar function is only defined for 2D plots.
Here’s one approach to plotting errorbars with plot3:
x = rand(10,1); % Create Data
y = rand(10,1); % Create Data
z = rand(10,1); % Create Data
errl = rand(10,1)/5; % Error Bar Low Limits
errh = rand(10,1)/5; % Error Bar High Limits
figure
plot3(x(:)', y(:)', z(:)') % Plot Data
hold on
plot3([x(:),x(:)]', [y(:),y(:)]', [-errl(:),errh(:)]'+z(:)', '-r') % Plot Error Bars
hold off
grid on
legend('Data','Errors')
These error bars don’t have crossbars at the ends, and it’s not immediately obvious to me how to add them.

Plotting a dot marker at the ends is one option, using '.-r' (instead of '-r') as the LineStyle.
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Errorbars에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!