绘图未返回x-ticks值

时间:2019-03-29 09:08:22

标签: python matplotlib

我正在尝试在折线图中绘制预测值。 X点应该是月份和年份(例如2016年4月)。问题是我的绘图顺序不正确,我看不到实际的x-tick值。

这是我的代码

ax_forecast= forecasted.groupby('Month_Year')['yhat'].sum().plot(figsize=(18,10))
ax_forecast.get_yaxis().get_major_formatter().set_scientific(False)

这是我要绘制的数据:

forecasted = {'yhat': {'April-2016': 43929615.41783013,
  'April-2017': 185274599.56791607,
  'August-2016': 60087106.8660238,
  'August-2017': 261765749.04794392,
  'December-2016': 124431182.12443578,
  'December-2017': 332058061.2991861,
  'February-2016': 34433800.70402009,
  'February-2017': 142399676.4087281,
  'January-2016': 34457502.66028841,
  'January-2017': 137696430.5545896,
  'July-2016': 54386802.22264939,
  'July-2017': 240745719.65645707,
  'June-2016': 47449151.90045062,
  'June-2017': 222406328.28095606,
  'March-2016': 42585010.655475326,
  'March-2017': 177069816.0218604,
  'May-2016': 46727385.96441124,
  'May-2017': 206100279.7210855,
  'November-2016': 102356396.73384078,
  'November-2017': 304690514.1417595,
  'October-2016': 88107961.21290714,
  'October-2017': 288239985.2960009,
  'September-2016': 70276527.38316415,
  'September-2017': 274392518.4590202}}

这是我得到的情节:enter image description here

0 个答案:

没有答案