我有一个标准的金融时间序列数据,在市场收盘时存在差距。
问题是Chaco显示了这些差距,我可以在 matplotlib 中使用格式化程序,如下所示并应用于 x 轴来解决这个问题,但我不确定在 Chaco 中我应该怎么做。
在 matplotlib 中:
class MyFormatter(Formatter):
def __init__(self, dates, fmt='%Y-%m-%d %H:%M'):
self.dates = dates
self.fmt = fmt
def __call__(self, x, pos=0):
'Return the label for time x at position pos'
ind = int(round(x))
if ind>=len(self.dates) or ind<0: return ''
return self.dates[ind].strftime(self.fmt)
在查科实现这一点的有效方法是什么?谢谢