我有一個傳說的情節。它的標題有多行,像這樣

由此代碼創建:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.plot()
legend = ax.legend(title="Line 1 is short\nLine 2 is slightly longer")
plt.show()
我希望圖例標題的各行居中。我該如何做到這一點?
uj5u.com熱心網友回復:
添加這將完成這項作業:
legend.get_title().set_multialignment('center')
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/414226.html
標籤:
