熊猫-给定范围的分类图

时间:2020-07-17 04:51:01

标签: python pandas

我必须在给定范围内绘制轴。在这里,学生编号按原样显示。但是,如果我希望x轴的最大值为50或100,我该怎么做?

e = {'student_id': ['10', '15','17','25','7','8','16'],
  'score': ['100', '50', '10', '60', '5','90','99' ]}
plt.plot('student_id','score',data=e)

enter image description here

3 个答案:

答案 0 :(得分:1)

plt.xlim(left_limit, right_limit) 可以使用,因为你可以申请 plt.xlim(0, 50)

答案 1 :(得分:1)

您可以使用 pyplot.axis()

plt.axis([XMIN, XMAX, YMIN, YMAX])

,或者您可以使用 pyplot.xlim()

plt.xlim(XMIN, XMAX)

答案 2 :(得分:1)

plt.xlim(min,max)是您要寻找的

e = {'student_id': ['10', '15','17','25','7','8','16'],
      'score': ['100', '50', '10', '60', '5','90','99' ]}
plt.xlim(0, 50) # or (0, 100)
plt.plot('student_id','score',data=e)