How to move the origin of the Y axis

75 visualizzazioni (ultimi 30 giorni)
jack Hardy
jack Hardy il 3 Dic 2019
Risposto: Image Analyst il 3 Dic 2019
Can you some one help me find out how to move the Y axis to the 0 origin

Risposte (1)

Image Analyst
Image Analyst il 3 Dic 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

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by