How to move the origin of the Y axis

75 views (last 30 days)
jack Hardy
jack Hardy on 3 Dec 2019
Answered: Image Analyst on 3 Dec 2019
Can you some one help me find out how to move the Y axis to the 0 origin

Answers (1)

Image Analyst
Image Analyst on 3 Dec 2019
Use the XAxisLocation and/or the YAxisLocation properties of the axes. Try this:
x = rand(1, 20) - 0.5;
y = rand(1, 20) - 0.5;
plot(x, y, 'b.', 'MarkerSize', 30, 'LineWidth', 2);
grid on;
% Move axes to origin.
ax = gca; % Get handles to axis.
ax.YAxisLocation = 'origin';
ax.XAxisLocation = 'origin';
0000 Screenshot.png

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!