d3轴日期在画笔/缩放上打勾

时间:2017-08-07 23:32:50

标签: d3.js

我已经能够使用优秀的教程进行画笔/缩放: https://bl.ocks.org/mbostock/34f08d5e11952a80609169b7917d4172

我正在使用以下比例和轴变量:

import matplotlib.pyplot as plt
from matplotlib.dates import DayLocator, MonthLocator, DateFormatter

fig, ax = plt.subplots(1,1)
ax.plot(df)
ax.xaxis.set_major_locator(MonthLocator())
ax.xaxis.set_major_formatter(DateFormatter('%Y-%m-%d'))
ax.xaxis.set_minor_locator(DayLocator([11,21]))
ax.xaxis.set_minor_formatter(DateFormatter('%Y-%m-%d'))
plt.setp(ax.xaxis.get_ticklabels(which='both'), rotation=70)
fig.tight_layout()
plt.show()

放大时看起来不错: enter image description here

然而,在缩小时它会变得非常紧凑: enter image description here

如何设置刻度线的最大数量,但将最精细的刻度限制为一天?

0 个答案:

没有答案
相关问题