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

3 views (last 30 days)
Szczepan Letkiewicz
Szczepan Letkiewicz on 3 Dec 2021
Commented: dpb on 5 Dec 2021
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?

Accepted Answer

dpb on 4 Dec 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

More Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by