Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    plot with logarithmic y axis

    General Code/Help
    2
    4
    1283
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Benoît Zuber last edited by

      Is it possible to use logarithmic scale for y axis when plotting with cerebro?

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        Use plotinfo=dict(plotlog=True) and try your luck.

        B 1 Reply Last reply Reply Quote 0
        • B
          Benoît Zuber @backtrader last edited by

          @backtrader Thanks. I couldn't get it to work. I am not plotting individual datas but only cash, value, and trades profits/losses. I wasn't sure where to specify plotinfo=...
          I tried in cerebro.plot(plotinfo=...) and cerebro.run(plotinfo=...) but y-scale was not logarhitmic.

          B 1 Reply Last reply Reply Quote 0
          • B
            backtrader administrators @Benoît Zuber last edited by

            No, plotinfo is a property (which you declara as a dict, but which supports dot notation too) of lines objects like data feeds, indicators ...

                mydata = bt.feeds.MyPreferredDatafeed(dataname='xxx')
                mydata.plotinfo.plotlog = True
            

            or

                # not recognized kwargs will be passed to plotinfo
                mydata = bt.feeds.MyPreferredDatafeed(dataname='xxx', plotlog=True)
            

            or

                class MyOwnLog(bt.feeds.MyPreferredDatafeed):
                    plotinfo(plotlog=True)
            
                mydata = bt.feeds.MyOwnLog(dataname='xxx')
            
            1 Reply Last reply Reply Quote 1
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors