Errorbar overlapping with the left and right border of a plot

1 view (last 30 days)
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?

Accepted Answer

Star Strider
Star Strider on 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.
.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!