【发布时间】:2017-03-19 00:44:03
【问题描述】:
我有这样的情节:
我想更改 12 个位置的刻度,以这种格式表示各自的月份:Jan-Feb_Mar...
当我使用 MonthLocator 功能时,刻度会从绘图中消失
ax = plt.gca()
ax.set_xlim([0, 365])
ax.xaxis.set_major_locator(MonthLocator())
ax.xaxis.set_minor_locator(MonthLocator(bymonthday=15))
ax.xaxis.set_major_formatter(ticker.NullFormatter())
ax.xaxis.set_minor_formatter(dates.DateFormatter('%b'))
我不知道这段代码的错误在哪里。谢谢
【问题讨论】:
标签: python matplotlib