matplotlib.figure.Figure.autofmt_xdate#

Figure.autofmt_xdate(bottom=0.2, rotation=30, ha='right', which='major')[source]#

日期刻度标签经常重叠,因此旋转并右对齐它们非常有用。此外,一个常见的用例是多个子图共享 x 轴,且 x 轴为日期数据。刻度标签通常很长,这时将其在底部子图上旋转,并在其他子图上关闭它们,以及关闭 x 轴标签会很有帮助。

参数:
bottomfloat, default: 0.2

子图的底部位置,用于 subplots_adjust

rotationfloat, default: 30 degrees

x 轴刻度标签的旋转角度,单位为度。

ha{'left', 'center', 'right'}, default: 'right'

x 轴刻度标签的水平对齐方式。

which{'major', 'minor', 'both'}, 默认值: 'major'

选择要旋转的刻度标签。

使用 matplotlib.figure.Figure.autofmt_xdate 的示例#

带透明度的 fill_between

带透明度的 fill_between

日期演示转换

日期演示转换