![](/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.