matlab中的交叉轴和标签

发布于 2024-08-05 19:08:55 字数 147 浏览 5 评论 0原文

我就是找不到它。如何在matlab中设置轴和标签,使它们在零点交叉,标签就在轴下方而不是在图的左侧/底部?

如果我没说清楚的话——我只是想让情节看起来像我们在学校时画的那样。轴交叉、4 个象限、轴正下方的标签、曲线……就这样。

有人知道如何设置吗?

I just can't find it. How to set up axis and labels in matlab so they cross at zero point, with the labels just below the axis not on left/bottom of the plot ?

If I didn't make myself clear - I just want the plot to look like like we all used to draw it when in school. Axes crossing, 4 quadrants, labels right below axis, curve ... as it goes.

Anyone knows how to set it up ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北渚 2024-08-12 19:08:55

您应该查看 The MathWorks File Exchange 上提交的两份内容:

希望这些可以与您拥有的任何 MATLAB 版本一起使用(Matt Fig 提交的是最新更新的版本) )。

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).

最单纯的乌龟 2024-08-12 19:08:55

从 Matlab R2015b 版本开始,这可以通过 axis 属性来实现 XAxisLocationYAxisLocation 设置为 origin

换句话说,

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

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

Axes through origin, from Matlab 官方文档

示例取自 MATLAB 官方文档:

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';

Axes through origin, from Matlab official documentation

Example is taken from MATLAB official documentation:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文