Domanda

Ho un Timeserie finanziario standard di dati che hanno lacune per quando il mercato è chiuso.

Il problema è chaco Visualizza queste lacune, potrei usare un formattatore in matplotlib come segueE applicare sull'asse X per aggirarlo, ma non sono sicuro di ciò che dovrei fare a riguardo a Chaco.

in 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)
.

Quale sarebbe il modo efficiente per implementare questo in Chaco? Grazie

È stato utile?

Soluzione

Passa i parametri come questo

from enthought.chaco.scales.formatters import TimeFormatter
TimeFormatter._formats['days'] = ('%d/%m', '%d%a',)
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top