首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >处理Chaco中的时间序列差距

处理Chaco中的时间序列差距
EN

Stack Overflow用户
提问于 2012-03-14 02:05:46
回答 1查看 678关注 0票数 14

我有一个标准的金融时间序列数据,其中有差距,当市场关闭。

问题是Chaco会显示这些间隙,我可以使用matplotlib中的格式化程序,如下所示,并应用到x轴来解决这个问题,但我不确定我应该在Chaco中对此做些什么。

在matplotlib中:

代码语言:javascript
复制
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)

在查科中实现这一点的有效方法是什么?谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-19 22:08:41

像这样传递参数

代码语言:javascript
复制
from enthought.chaco.scales.formatters import TimeFormatter
TimeFormatter._formats['days'] = ('%d/%m', '%d%a',)
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9689586

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档