我有一个像
的表AAge Income
16 90000
18 2000000
19 60000
20 60000
21 50000
22 60000
23 55000
24 50000
26 63333
27 50000
28 1030000
29 20000
31 45000
33 70000
34 50000
35 43333
36 20000
37 20000
38 80000
39 50000
40 80000
41 60000
42 40000
43 35000
44 60000
45 55000
46 65000
47 50000
48 2000000
49 2000000
tableA是
的结果tableA.groupby(['Age'])['Rounded_Incomes'].mean().astype(int).plot(kind='line')
由于某些收入非常大,例如2000000或1030000 ..因此结果如下:
如何绘制线条char集中在较小的数字(例如18000〜80000)上,但在图形中仍然具有较大的数字(1030000/2000000)?
谢谢
答案 0 :(得分:2)
import matplotlib.pyplot as plt
tableA.groupby(['Age'])['Rounded_Incomes'].mean().astype(int).plot(kind='line')
plt.ylim(18000, 80000)
此外,将y轴放在对数刻度上可能会有所帮助。
tableA.groupby(['Age'])['Rounded_Incomes'].mean().astype(int).plot(kind='line', logy=True)