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");  
相关推荐
猿界零零七6 小时前
pip install mxnet 报错解决方案
python·pip·mxnet
I_LPL6 小时前
hot100贪心专题
数据结构·算法·leetcode·贪心
不只会拍照的程序猿8 小时前
《嵌入式AI筑基笔记02:Python数据类型01,从C的“硬核”到Python的“包容”》
人工智能·笔记·python
Jay_Franklin8 小时前
Quarto与Python集成使用
开发语言·python·markdown
Oueii8 小时前
Django全栈开发入门:构建一个博客系统
jvm·数据库·python
2401_831824969 小时前
使用Fabric自动化你的部署流程
jvm·数据库·python
njidf9 小时前
Python日志记录(Logging)最佳实践
jvm·数据库·python
@我漫长的孤独流浪9 小时前
Python编程核心知识点速览
开发语言·数据库·python
宇擎智脑科技9 小时前
A2A Python SDK 源码架构解读:一个请求是如何被处理的
人工智能·python·架构·a2a
2401_851272999 小时前
实战:用Python分析某电商销售数据
jvm·数据库·python