相关疑难解决方法(0)

用Python中的TeX在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") 
Run Code Online (Sandbox Code Playgroud)

理想情况下,我希望y-labeled也能居中.有没有办法做到这一点?标签同时包含TeX(包含在'$'中)和换行符非常重要.

python graphing plot matplotlib

61
推荐指数
3
解决办法
6万
查看次数

标签 统计

graphing ×1

matplotlib ×1

plot ×1

python ×1