如何在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")
Run Code Online (Sandbox Code Playgroud)
理想情况下,我希望y-labeled也能居中.有没有办法做到这一点?标签同时包含TeX(包含在'$'中)和换行符非常重要.