gpt4 book ai didi

python - matplotlib 用非 ascii 和 LaTeX 字符将标题拆分为两行

转载 作者:行者123 更新时间:2023-12-01 02:49:51 25 4
gpt4 key购买 nike

我需要使用其中包含非 ascii 字符的 matplotlib.pyplot 将图形标题拆分为两行。

这是我迄今为止尝试过的:

plt.title(u"Some very long string with non ascii chara éèàéüöëêâûô\n"
"and the next line should be here, with maybe some LaTeX symbols like greek letters in addition éèàéüöëêâûô")

plt.title(r"Some very long string with non ascii chara éèàéüöëêâûô\n"
"and the next line should be here, with maybe some LaTeX symbols like greek letters in addition éèàéüöëêâûô")

两个语句版本都返回了一些错误。

最佳答案

不要以 " 结束该行:

plt.title(u"Some very long string with non ascii chara éèàéüöëêâûô\n and the next line should be here, with maybe some LaTeX symbols like greek letters in addition éèàéüöëêâûô")

或者尝试:

plt.title(u"""Some very long string with non ascii chara éèàéüöëêâûô
and the next line should be here, with maybe some LaTeX symbols like greek letters in addition éèàéüöëêâûô""")

关于python - matplotlib 用非 ascii 和 LaTeX 字符将标题拆分为两行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44911714/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com