Errorbar overlapping with the left and right border of a plot

2 vues (au cours des 30 derniers jours)
Fan Yang
Fan Yang le 27 Oct 2021
Commenté : Star Strider le 28 Oct 2021
a = [1,2,3,4;5,6,7,8]
errorbar(mean(a),std(a))
The two lines of code above generate an line of mean value with errorbars. However, the leftmost and the rightmost errorbar overlapped with the left and right border of the plot. Is there anyway to avoid it?

Réponse acceptée

Star Strider
Star Strider le 27 Oct 2021
Add an xlim (or axis) call —
a = [1,2,3,4;5,6,7,8]
a = 2×4
1 2 3 4 5 6 7 8
figure
errorbar(mean(a),std(a))
xlim(xlim+[-1 1]*0.2) % <— ADD THIS
Make appropriate changes to get the desired result.
.
  2 commentaires
Fan Yang
Fan Yang le 28 Oct 2021
Thanks, Star Strider!
Star Strider
Star Strider le 28 Oct 2021
As always, my pleasure!
.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Errorbars 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