14

市場が閉鎖されたときのギャップがある標準的な金融時系列のデータがあります。

問題は、 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)

これを Chaco に実装する効率的な方法は何でしょうか? ありがとう

4

1 に答える 1

2

このようなパラメータを渡します

from enthought.chaco.scales.formatters import TimeFormatter
TimeFormatter._formats['days'] = ('%d/%m', '%d%a',)
于 2012-07-19T14:08:41.097 に答える