在y轴上添加文本-MATLAB [英] Adding text to y-axis - MATLAB

查看:105
本文介绍了在y轴上添加文本-MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图,我想在y轴上添加1σ,2σ,3σ等值,而不是MATLAB分配的数字.但是,x轴保持正常.有什么办法吗?

I have a plot and I would like to add on the y-axis the values of 1σ, 2σ, 3σ etc. instead of numbers assigned by MATLAB. However, the x-axis remains as normal. Is there any way to do this?

谢谢

推荐答案

更改刻度标签很容易,如下面的示例所示.

Changing the tick labels is easy, as you can see from the following example.

x = 0:pi/500:2*pi;
y = sin(x);
plot(y, x);
set(gca, 'YTick', [0 pi/2 pi 1.5*pi 2*pi]);
set(gca, 'YTickLabel', {'0', 'pi/2', 'pi', '3/2 pi', '2 pi'});

但是,仍然不支持(la)tex解释器,因此您应该考虑将标签替换为text对象.

However, the (la)tex interpreter is still unsupported and hence you should consider to replace the labels with text objects.

可以找到一些解决此问题的尝试:

Some attempts to solve this problem can be found in:

http://blogs.mathworks.com/pick/2007/09/24/tex-interpreter-in-x-tick-and-y-tick-labels/

http://www.mathworks.com/matlabcentral/fileexchange/15986-format-tick-labels

http://www .mathworks.com/matlabcentral/fileexchange/16003-tick2text--创建易于定制的刻度标签

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆