How to move the origin of the Y axis
69 views (last 30 days)
Show older comments
Can you some one help me find out how to move the Y axis to the 0 origin
0 Comments
Answers (1)
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';
0 Comments
See Also
Categories
Find more on Line Plots 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!