从联机阅读(比如here,尽管他们导入pylab而不是pyplot,我从中得到了相同的结果),当使用pyplot的show方法时,如果图形被放置在主图之外,它应该自动重新缩放图形以包括图例;但是,这似乎不会发生在我的代码中。在
有人知道怎么做吗?谢谢。在
# Cut down example of graph drawing, with cut-off legend
plt.xlim([0,1])
plt.ylim([0,1])
line_x = line[t2][0::2]
line_y = line[t2][1::2]
plt.plot(line_x, line_y, label="Line")
plt.grid("on")
plt.tight_layout()
plt.legend(bbox_to_anchor=(1.01, 0.5), loc="center left")
plt.show()
目前没有回答
相关问题 更多 >
编程相关推荐