我有一个情节如下:
%matplotlib inline
import matplotlib.pyplot as plt
df[['Year','Unemployment with primary education (% of total
unemployment)','Unemployment with secondary education (% of total
unemployment)','Unemployment with tertiary education (% of total
unemployment)']].set_index('Year').plot()
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))
我只想将 x 轴限制为 2005 年。我该怎么做?
请您参考如下方法:
我没有你的数据,但如果 'year' 是一个简单的数字,你可以通过调用
plt.xlim(None, 2005)
