美文网首页
13.3 Plotting on the same axis

13.3 Plotting on the same axis

作者: wanggs66 | 来源:发表于2020-05-02 09:33 被阅读0次

    Example:

    import backtrader as bt
    
    cerebro = bt.Cerebro()
    
    data0 = bt.feeds.MyFavouriteDataFeed(dataname='futurename')
    cerebro.adddata(data0)
    
    data1 = bt.feeds.MyFavouriteDataFeed(dataname='spotname')
    data1.compensate(data0)  # let the system know ops on data1 affect data0
    data1.plotinfo.plotmaster = data0
    data1.plotinfo.sameaxis = True
    cerebro.adddata(data1)
    
    ...
    
    cerebro.run()
    

    data1 gets some plotinfo values to:

    • Plot on the same space as plotmaster which is data0

    • Get the indication to use the sameaxis

    The reason for this indication is that the platform cannot know in advance if the scales for each data will be compatible. That’s why it will plot them on independent scales

    相关文章

      网友评论

          本文标题:13.3 Plotting on the same axis

          本文链接:https://www.haomeiwen.com/subject/hjghghtx.html