【问题标题】:How to add Greek letter to data cursor in Matlab figure?如何在 Matlab 图中将希腊字母添加到数据光标?
【发布时间】:2011-11-14 08:28:54
【问题描述】:

我在 Matlab 图中添加了一个数据光标,这是我单击“编辑文本更新函数...”时显示的代码

function output_txt = myfunction(obj,event_obj)
% Display the position of the data cursor
% obj          Currently not used (empty)
% event_obj    Handle to event object
% output_txt   Data cursor text string (string or cell array of strings).

pos = get(event_obj,'Position');
output_txt = {['X: ',num2str(pos(1),4)],...
    ['Y: ',num2str(pos(2),4)]};
% If there is a Z-coordinate in the position, display it as well
if length(pos) > 2
    output_txt{end+1} = ['Z: ',num2str(pos(3),4)];
end

我在这里要做的是将字符“X”、“Y”替换为希腊字符,如“alpha”或“beta”。我该怎么做?

谢谢!

【问题讨论】:

标签: matlab symbols figure


【解决方案1】:

\alpha (和一些 LaTeX 符号)在标题中起作用,在这种情况下也可能如此。 注意:\Alpha 是大写的希腊字母,\alpha 是小写的。

看到这个table

编辑:另见 Amro cmets 以激活 (La)TeX 解释器。

【讨论】:

  • 此外,detexify (detexify.kirelabs.org/classify.html) 是一个很好的工具,可以通过在画布上绘图来自动查找 LaTeX 符号定义。
  • @ClementJ.:默认情况下这不起作用,您需要将文本解释器设置为'tex'。查看链接的问题
  • @Amro, 'tex' 似乎是参数的默认值。无论如何,您指出它是对的。
  • @ClementJ.:虽然它适用于普通文本,但数据提示并非如此(再次阅读我链接到的 gnovice 的答案)。因此,您必须明确设置解释器来解析 TeX/LaTeX:set(findall(gcf, 'Type','text', 'Tag','DataTipMarker'), 'Interpreter','tex')
  • 关于 MATLAB 文本格式的非常好的结论,包括有关希腊字母的详细信息:mathworks.de/de/help/matlab/creating_plots/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-15
  • 2021-02-06
  • 1970-01-01
  • 1970-01-01
  • 2011-08-28
相关资源
最近更新 更多