如何将 matplotlib 图形的 `ylabel` 拆分成行?

How can I split the `ylabel` of a matplotlib figure into rows?

如何将 matplotlib 图形的 ylabel 拆分成行?我想保持 y 轴上的 ylabel 旋转。例如,here's my subplot 到目前为止,代码的相关部分如下:

plt.ylabel('Spacing of Zeroes of $J_{\nu}(x)$', rotation=0)

当我尝试这样做时:

plt.ylabel('Spacing of Zeroes of $J_{\nu}(x)$', rotation=0, ncol=2)

我收到此错误:

AttributeError: Unknown property ncol

我的建议是在字符串中引入换行符。

plt.ylabel('Spacing of\nZeroes of\n$J_{\nu}(x)$', rotation=0, ha="right")

你可以用这个。 https://matplotlib.org/2.0.2/examples/pylab_examples/multiline.html

plt.xlabel('this is a xlabel\n(with newlines!)')
plt.ylabel('this is vertical\ntest', multialignment='center')