matlab - 将文本置于图的前面

标签 matlab text rotation matlab-figure bringtofront

我在 MATLAB 中有一个图形。然后我通过键入向其中添加文本,

b = text(0.5, 0.5, 'Detector action', 'Rotation', -70, 'FontSize', 25);

但是文字在图的后面(见下图), enter image description here

我也试过了,

uistack(b, 'top');

但是没用。

最佳答案

最简单的方法就是不用 text完全没有,而是使用 annotation ,因为这样的对象将(至少在默认情况下)位于轴上方(因此,绘制在其中的任何内容)。

annotation 对象的技巧在于,与直觉相反,我们需要使用TextBox,而是使用TextArrow。 ,同时使箭头本身不可见。

例如:

figure(); membrane(); 
annotation('TextArrow', [.5 .5], [.5 .5], 'String','Some text', 'TextRotation', -30, ...
           'HeadStyle','none','TextBackgroundColor','w' );

enter image description here

关于matlab - 将文本置于图的前面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53873503/

相关文章:

ffmpeg - 使用 ffprobe 5 和更新版本提取旋转数据

matlab - 嵌套循环优化

excel - 在 MATLAB 中使用贝塞尔函数

r - 在字符串的最后一个元素之前插入 "and"

javascript - jquery 旋转功能不起作用

iOS 旋转中心按钮

Matlab mcc 警告 "Adding path ... to Compiler path instance"

matlab - 如何在一个等价语句中包含多个条件?

java - 如何使用java清理脏文本

html - 调整菜单中文本的垂直位置