Tag: pyp

用TeX在Python中把换行符放在matplotlib标签中?

如何在matplotlib中添加一个换行符到阴谋的标签(例如xlabel或ylabel)? 例如, plt.bar([1, 2], [4, 5]) plt.xlabel("My x label") plt.ylabel(r"My long label with $\Sigma_{C}$ math \n continues here") 理想情况下,我希望y标签也是中心。 有没有办法做到这一点? 这个标签有TeX(用'$'括起来)和换行符是非常重要的。