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

6 vues (au cours des 30 derniers jours)
Szczepan Letkiewicz
Szczepan Letkiewicz le 3 Déc 2021
Commenté : dpb le 5 Déc 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?

Réponse acceptée

dpb
dpb le 4 Déc 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 commentaires
Szczepan Letkiewicz
Szczepan Letkiewicz le 4 Déc 2021
Oh you need to put it into the command window. Got it works now thank you!
dpb
dpb le 5 Déc 2021
Or, write a script from the git-go.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Properties dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by