MATLAB Answers

Y-Axis location in MATLAB plots

88 views (last 30 days)
I've seen plots with y-axis at the center of the plot rather than to the left. How do I do this in MATLAB?
  2 Comments
henry wang
henry wang on 27 Jan 2011
I'm just talking about simple plot function like plot(something). How to adjust the axis so y axis shows at the center.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 27 Jan 2011
PlotAxisAtOrigin Matlab File Exchange contribution

More Answers (2)

Oleg Komarov
Oleg Komarov on 27 Jan 2011

Or another submission axescenter by Matt Fig:


Wenxuan Liang
Wenxuan Liang on 10 Mar 2021
Just use set(gca, 'YAxisLocation', 'origin') if you are using a MATLAB newer than 2018, I think

Community Treasure Hunt

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

Start Hunting!