python+matlab text(按图的相对位置显示)

python

用 python 画图时,如果想采用归一化的坐标来指定文本框的位置,则需要用到 transform = ax.transAxes 参数,如

python 复制代码
ax = plt.gca()
plt.text(0.1,0.2, "text", fontsize = 20, transform = ax.transAxes)

matlab

方法1

text(___,Name,Value) 使用一个或多个名称-值对组指定 Text 对象的属性。例如,'FontSize',14 将字体大小设置为 14 磅。您可以使用上述语法中的任意输入参数组合指定文本属性。如果您将 Position 和 String 属性指定为名称-值对组,则不需要指定 x、y、z 和 txt 输入(这种方法是使用键-对值)

bash 复制代码
text( 'string',"(a) UB-OR", 'Units','normalized','position',[0.75,0.95]);  
方法2

% TEXT(X,Y,str,'sc') interprets the (X,Y) points in normalized axis

% coordinates, where (0,0) is the lower-left corner of the current axes,

% and (1,1) is the upper-right.

bash 复制代码
text( 0.75,0.95,"(a) UB-OR", "sc");  
相关推荐
张槊哲9 分钟前
函数的定义与使用(python)
开发语言·python
船长@Quant14 分钟前
文档构建:Sphinx全面使用指南 — 实战篇
python·markdown·sphinx·文档构建
我想进大厂40 分钟前
图论---朴素Prim(稠密图)
数据结构·c++·算法·图论
我想进大厂1 小时前
图论---Bellman-Ford算法
数据结构·c++·算法·图论
lkbhua莱克瓦241 小时前
用C语言实现——一个中缀表达式的计算器。支持用户输入和动画演示过程。
c语言·开发语言·数据结构·链表·学习方法·交友·计算器
偶尔微微一笑1 小时前
AI网络渗透kali应用(gptshell)
linux·人工智能·python·自然语言处理·编辑器
沅_Yuan1 小时前
基于贝叶斯优化的Transformer多输入单输出回归预测模型Bayes-Transformer【MATLAB】
神经网络·matlab·回归·贝叶斯·transformer·回归预测
船长@Quant3 小时前
文档构建:Sphinx全面使用指南 — 基础篇
python·markdown·sphinx·文档构建
喵手3 小时前
从 Java 到 Kotlin:在现有项目中迁移的最佳实践!
java·python·kotlin
liuweidong08023 小时前
【Pandas】pandas DataFrame rsub
开发语言·python·pandas