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/

    Date Axis does not show up on plot

    General Code/Help
    2
    3
    721
    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.
    • G
      genkisushijai last edited by

      Hi all.

      When I run cerebro.plot(), my plot does not contain an X-axis for date. However, when I put my mouse cursor over the matplotlib graph in jupyter notebook.

      Any advice on how to get the X date axis on the plot? Thanks!

      alt text

      1 Reply Last reply Reply Quote 0
      • MrKalindro
        MrKalindro last edited by

        Afaik it's matplotlib issue, there are many of them with the newest version. I recommend downgrading to lower version (3.0.3 works perfectly for me).

        1 Reply Last reply Reply Quote 0
        • G
          genkisushijai last edited by

          @MrKalindro thanks. I was able to get it working with Matplotlib 3.2.2 by changing one line - line 264 - in plot.py. Specifically, I added visible=True.

                  259: # Applying fig.autofmt_xdate if the data axis is the last one
                  260 # breaks the presentation of the date labels. why?
                  261 # Applying the manual rotation with setp cures the problem
                  262 # but the labels from all axis but the last have to be hidden
                  263 for ax in laxis:
                      264 self.mpyplot.setp(ax.get_xticklabels(), visible=True)
          

          I have another question. How can I set the frequency of the ticks in the x-axis (date axis)? I want to set the ticks to appear more frequently (ex: every 2 weeks, or every month) instead of once every 2 months.

          alt text

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