调整坐标轴范围
原图
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-10, 10)
plt.plot(x, x**2)
print(plt.axis())#输出坐标轴范围
(-10.95, 9.95, -5.0, 105.0)
plt.axis([-5, 5, 0, 80])#调整四个值
plt.xlim([-5, 5])#只调x轴
plt.ylim([0, 80])#只调y轴
plt.xlim(left=-5)#只调整x轴左侧
拜师教育学员文章:作者:587-王同学,
转载或复制请以 超链接形式 并注明出处 拜师资源博客。
原文地址:《Matplotlib可视化(十五)–坐标轴范围调整》 发布于2020-03-04
评论 抢沙发