我有一个图表,上面有情节外的传说.我有标题在图表的中心,我想保持它的中心.问题是,标题只围绕着图表,而不是图表和图例作为一个组.所以它让我的情节看起来总是扭曲的: [1]:https://i.stack.imgur.com/dOlpS.png人
有没有一种方法可以将图表移到一边,使标题显示在两者的中心?
最小生殖率:
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0,10,1000)
y1 = np.sin(x)
y2 = np.cos(x)
plt.plot(x,y1)
plt.plot(x,y2)
plt.title("A very long title that makes the graph shorter than the title itself, it's so long it makes me sick to the core")
plt.legend(["sin x", "cos x"], bbox_to_anchor = [1,0.5], loc = "center left", fontsize = 20)
plt.show()