相关疑难解决方法(0)

Matplotlib 中的 MonthLocator

我有这样的情节:

在此处输入图片说明

我想更改 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)

我不知道这段代码中的错误在哪里。谢谢

python matplotlib

2
推荐指数
1
解决办法
9726
查看次数

标签 统计

matplotlib ×1

python ×1