How can I add error bars to my scatter plot if I only have a .fig file.

6 Ansichten (letzte 30 Tage)
I have imported data from an excel sheet, x and y values and their respective errors. How can I plot a scatter graph with error bars? I have used the plot/figure editor and its property inspector to customize my graph, but I cannot add the error bars to it. I know that I can use:
errorbar(x_err, y_err, 'LineStyle','none');
But I don't have where to write it. When I use the "generate function" option from the editor, I receive a number of errors and my graph doesn't appear the same as in the editor. Is there any way I can use the graph that I customized in the editor, or do I need to make a new plot by writing a script?

Akzeptierte Antwort

dpb
dpb am 4 Dez. 2021
If the figure is the current one, then
hAx=gca; % get handle to current axes
hold on % add to gca
errorbar(hAx,x_err,y_err,'LineStyle','none') % the hAx is superfluous if is gca, but can't hurt
  2 Kommentare
Szczepan Letkiewicz
Szczepan Letkiewicz am 4 Dez. 2021
Oh you need to put it into the command window. Got it works now thank you!
dpb
dpb am 5 Dez. 2021
Or, write a script from the git-go.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by