Drawing the x-axis at y=0
513 views (last 30 days)
Show older comments
David on 4 Nov 2011
Commented: Gehad Qaki on 7 Dec 2022
Hello. At least as the default option, MATLAB draws the x-axis at the bottom-most part of the graph. However, I would like to draw it at y=0 as is a common convention. Is it possible in MATLAB? (including the scale on the axis, and replacing the default axis drawn at the bottom)
Brian Russell on 30 Apr 2021
if all you want is dark axes on your plot at x = 0 and y = 0 you just need the commands xline(0) and yline(0). This question is all over MATLAB Central and everybody gives a more complicated solution. Maybe i don't understand the question!
Gehad Qaki on 7 Dec 2022
This is incredible @Brian Russell. Thank you so much for the very simple solution to a very simple problem. I urge everyone to upvote this response so people see it quicker!
More Answers (3)
Amith Kamath on 4 Nov 2011
You may want to look at this example:
Jan on 4 Nov 2011
Meade on 18 Jan 2017
For posterity, this has been fixed in the HG2 Update. Linked below since this thread is currently the top search result on the topic.
Walter Roberson on 3 Mar 2021
Edited: Walter Roberson on 1 May 2021
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!