有什么方法可以增加matplotlib文本中字符之间的间距吗?我指的是绘图区域中的文本,就像plt.text()一样。我尝试了stretch参数,但效果很微妙,不清楚它是改变了间距还是只是让角色变得更瘦了。如果有必要,我不介意在字符之间手动插入一些东西,比如部分空格。
发布于 2019-11-13 01:59:33
我在这里找到了答案:Python adding space between characters in string. Most efficient way
s = "BINGO"
print(" ".join(s))因此,对于Matplotlib文本,它将如下所示:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
fig.text(0.5, 0.5," ".join('Line 1'))
plt.show()https://stackoverflow.com/questions/58822639
复制相似问题