How to move the origin of the Y axis

71 次查看(过去 30 天)
Can you some one help me find out how to move the Y axis to the 0 origin

回答(1 个)

Image Analyst
Image Analyst 2019-12-3
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

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by