我有这样的情节:
我想更改 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'))
Run Code Online (Sandbox Code Playgroud)
我不知道这段代码中的错误在哪里。谢谢