matplotlib实现自动调整横纵坐标范围

#自动调整图幅范围
xmin, xmax = ax.get_xlim()#获取x极值
ymin, ymax = ax.get_ylim()#获取y的极值
x_adjustment = (xmax - xmin) * 0.1
y_adjustment = (ymax - ymin) * 0.1
ax.axis([xmin-x_adjustment, xmax+x_adjustment, ymin-y_adjustment, ymax+y_adjustment])#调整坐标轴

你可能感兴趣的:(python可视化,matplotlib,python)