我正在绘制以下图表:
使用以下代码:
fig, ax = plt.subplots(figsize=(20, 3))
mpf.candlestick_ohlc(ax,quotes, width=0.01)
ax.xaxis_date()
ax.xaxis.set_minor_locator(mpl.dates.HourLocator(interval=4) )
ax.xaxis.set_minor_formatter(mpl.dates.DateFormatter('%H:%M'))
plt.xticks(rotation = 90)
plt.grid(True)
plt.show()
我还想旋转小刻度线:我该怎么做?
附属问题有没有办法用一个命令同时旋转主要和次要刻度?
最佳答案
你可以通过一行代码plt.setp(ax.xaxis.get_minorticklabels(), rotation=90)
进行旋转。
关于python - 在 matplotlib 中旋转小刻度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41390487/