Backtrader Community

    • 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 size miscalculated.

    Indicators/Strategies/Analyzers
    1
    1
    239
    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.
    • Y
      yacc2000 last edited by

      I have multiple data feed, but I want to plot each data feed in individual figure separately.

      So base on the idea of this topic:
      https://community.backtrader.com/topic/1041/plot-backtesting-results-in-multiple-graphs

      I did it in this way:

              for i in range( len(cerebro.datas) ):  # five data feed
                  bt_data = cerebro.datas[i]
                  for cb_data in cerebro.datas:
                      cb_data.plotinfo.plot = False
                  bt_data.plotinfo.plot = True  #only plot one data per figure
                  if i == 0: #index
                      plot_range = None
                  else:
                      plot_range = stock_data[i]["plotrange"]
                  fig2d = cerebro.plot()
      

      But figure size is not correct:
      5figure.png
      We can see a big blank area under the plot.
      The more date feed the bigger blank area:
      10figure.png
      How could I fix the plot size. Or could anybody please tell me which part of code should I inspect to correct the plot size?

      Thanks in advance.

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors