pydisp.py 文件源码

python
阅读 48 收藏 0 点赞 0 评论 0

项目:pydisp 作者: dimatura 项目源码 文件源码
def dyplot(data, **kwargs):
    """ Plot data as line chart with dygraph
    Params:
        data: either a 2-d numpy array or a list of lists.
        win: pane id
        labels: list of series names, first series is always the X-axis
        see http://dygraphs.com/options.html for other supported options
    """
    win = kwargs.get('win') or uid()

    dataset = {}
    if type(data).__module__ == np.__name__:
        dataset = data.tolist()
    else:
        dataset = data

    # clone kwargs into options
    options = dict(kwargs)
    options['file'] = dataset
    if options.get('labels'):
        options['xlabel'] = options['labels'][0]

    # Don't pass our options to dygraphs.
    options.pop('win', None)

    return pane('plot', kwargs.get('win'), kwargs.get('title'), content=options)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号