我希望将
这是我现有的代码中相关的部分:
以下链接是我得到的一个输出图形示例:plot 我该如何做到这一点?
x
和 y
轴的长度设置为相等(即绘图减去图例的部分应该是正方形)。我希望把图例绘制在外部(我已经能够让图例位于图框外部)。数据中x轴
的跨度(x_max - x_min
)与y轴
的跨度(y_max - y_min
)不同。这是我现有的代码中相关的部分:
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), fontsize=15 )
plt.axis('equal')
plt.tight_layout()
以下链接是我得到的一个输出图形示例:plot 我该如何做到这一点?
plt.tight_layout()
时出现的)。在使用上述建议后,这是我得到的图。(https://i.stack.imgur.com/sn6zj.png)如何避免图形的两侧被切掉? - user10853036axes = plt.gca()
,第二行:axes.set_aspect(np.diff(axes.get_xlim())/np.diff(axes.get_ylim()))
,第三行:plt.tight_layout()
,第四行:plt.savefig('filename.png')
- user10853036