![](/img/trans.png)
[英]How to change all text sizes in figure when using python matplotlib?
[英]Python: Matplotlib: how to print ONE text with different sizes in it?
matplotlib中是否可能在一个字符串中包含一个具有不同字体大小的文本框?
感谢帮助
我认为如果不使用LaTeX文本渲染器就无法做到这一点。 要使用此功能,
from matplotlib import rcParams
rcParams['text.usetex'] = True
然后,您可以使用标准LaTeX语法打印多字体大小的字符串,例如
from matplotlib import pyplot as plt
ax = plt.axes()
ax.text(0.5, 0.5, r'{\tiny tiny text} normal text {\Huge HUGE TEXT}')
有时LaTeX字体渲染器并不理想(例如,请注意,刻度标签字体与普通的MPL刻度标签不同),但它肯定更灵活。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.