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 question

    General Code/Help
    4
    7
    4424
    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.
    • A
      Alain last edited by

      Hi!
      When I make a plot as in the following:

      num = 20
      fig = cerebro.plot(numfigs = num, barupfill = False, bardownfill = False, style = 'candle', plotdist = 0.5, 
                         figsize=(30,30), volume = False, barup = 'green', valuetags = False, subtxtsize = 7,
                         start = startdate, end = enddate)
      
      for i in range(num):
          fig[0][i].tight_layout()
          fig[0][i].savefig(output_folder + '/{}_'.format(timeframe) + stratname + '_{}'.format(strat_type) + '_plot{}.png'.format(i), dpi=300, hight = 30, width = 30, tight = True)
      

      I get one very nice big plot as can be seen here (it's the second image printed):
      0_1547319328385_30min_boll_macd_long_plot1.png

      and 19 small not so nice plots (where one can be seen here):
      0_1547319813967_30min_boll_macd_long_plot2.png

      What could be the reason ? Would love to see 20 plots similar to the first one.

      Thank you for your help!

      B 1 Reply Last reply Reply Quote 0
      • N
        nikitaj last edited by

        @alain said in plot size question:

        figsize=(30,30)

        Hey @Alain, I was wondering how you got the plot to change size at all!? Which IDE are you using?

        Best,
        Nikitaj

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

          @alain said in plot size question:

          hight = 30
          

          Things are in the matplotlib arena, but that could have something to do with it.

          1 Reply Last reply Reply Quote 1
          • A
            Alain last edited by

            Hi @nikitaj and @backtrader

            Actually the figsize = (30,30) command didn't do anything to the plots. I also deleted hight = 30, but nothing changed...
            I'm using anaconda -> spyder.

            The code now looks like this

            fig = cerebro.plot(numfigs = num,barupfill = False, bardownfill = False, style = 'candle', plotdist = 0.5, 
                               volume = False, barup = 'green', valuetags = False, subtxtsize = 7,
                               start = startdate, end = enddate)
            
            for i in range(num):
                fig[0][i].tight_layout()
                fig[0][i].savefig(output_folder + '/{}_'.format(timeframe) + stratname + '_{}'.format(strat_type) + '_plot{}.png'.format(i), dpi=500)
            

            and unfortunately I still get one nice plot and all others are small... no idea why.
            Should all plots look like the big one I posted ?

            Thanks,
            Alain

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

              @alain said in plot size question:

              I'm using anaconda -> spyder.

              Do it in the shell.

              1 Reply Last reply Reply Quote 0
              • A
                Alain last edited by

                same result unfortunately... also updated matplotlib, de- and reinstalled anconda, but nothing helps so far.

                1 Reply Last reply Reply Quote 0
                • L
                  linearalgebra last edited by

                  I have the same problem but when I remove bt.ind.StdDev from the strategy the fig size becomes okay.

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