autofmt_xdate()不能将标签显示为对角线。
创始人
2024-11-12 14:00:26
0

可以使用set_rotate_mode()方法来设置标签的旋转模式,从而实现对角线显示。例如:

import matplotlib.pyplot as plt
import matplotlib.dates as mdates

fig, ax = plt.subplots()

# 添加日期数据
dates = ['2021-01-01', '2021-01-02', '2021-01-03', '2021-01-04', '2021-01-05', '2021-01-06']
y = [1, 2, 3, 4, 5, 6]
ax.plot(dates, y)

# 设置日期格式
date_format = mdates.DateFormatter('%Y%m%d')
ax.xaxis.set_major_formatter(date_format)

# 设置日期间隔
ax.xaxis.set_major_locator(mdates.DayLocator())

# 设置标签对角线显示
fig.autofmt_xdate()
ax.xaxis.set_rotate_mode('default')

plt.show()

相关内容

热门资讯

事发当天!wepoker透视脚... 事发当天!wepoker透视脚本是什么(透视)一直有挂(有挂解惑开挂辅助安装)-哔哩哔哩1、首先打开...
突发!impoker辅助,po... 突发!impoker辅助,poker world辅助,方案教程(有挂工具)-哔哩哔哩一、poker ...
有玩家发现!newpoker脚... 有玩家发现!newpoker脚本(透视)原来真的有挂(有挂解惑开挂辅助辅助器)-哔哩哔哩1、首先打开...
记者获悉!wepoker怎么看... 您好,wepoker怎么看底牌这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054...
昨日!wepoker透视脚本(... 昨日!wepoker透视脚本(透视)其实确实有挂(真实有挂开挂辅助工具)-哔哩哔哩1、在wepoke...
为切实保障!wepoker透视... 为切实保障!wepoker透视有吗,pokerrrr2辅助,方针教程(有挂技术)-哔哩哔哩1、起透看...
为了进一步!hhpoker怎么... 为了进一步!hhpoker怎么破解(透视)原来是有挂(有挂方针开挂辅助下载)-哔哩哔哩1、完成hhp...
近日!智星菠萝透视,智星菠萝透... 近日!智星菠萝透视,智星菠萝透视,模板教程(有挂透明挂)-哔哩哔哩1、全新机制【智星菠萝透视软件透明...
截至目前!wepoker免费脚... 截至目前!wepoker免费脚本咨询(透视)原来有挂(有挂秘笈开挂辅助平台)-哔哩哔哩1、任何wep...
有了最新消息!xpoker辅助... 有了最新消息!xpoker辅助神器,wepoker怎么发冤家牌,策略教程(有挂教程)-哔哩哔哩1、在...