Crossing axis and labels in matlab

别说谁变了你拦得住时间么 提交于 2019-11-29 02:26:13

You should check out two submissions on The MathWorks File Exchange:

Hopefully these will work with whatever MATLAB version you have (the submission from Matt Fig is the most recently updated one).

David_G

As of Matlab release R2015b, this can be achieved with the axis property XAxisLocation and YAxisLocation being set to origin.

In other words,

x = linspace(-5,5);
y = sin(x);
plot(x,y)

ax = gca;
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';

Example is taken from MATLAB official documentation:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!