plot3 error bars

29 Ansichten (letzte 30 Tage)
Scott Gorman
Scott Gorman am 18 Mai 2019
Kommentiert: Star Strider am 18 Mai 2019
Hi all, does anyone know how I might add an error bar to a data point along the Z axis for a plot3 plot?

Akzeptierte Antwort

Star Strider
Star Strider am 18 Mai 2019
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.
plot3 error bars - 2019 05 18.png
Plotting a dot marker at the ends is one option, using '.-r' (instead of '-r') as the LineStyle.
  2 Kommentare
Scott Gorman
Scott Gorman am 18 Mai 2019
Thank you very much!
Star Strider
Star Strider am 18 Mai 2019
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Errorbars finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by