Home > Software engineering >  how to make the mplfinance charts always display years
how to make the mplfinance charts always display years

Time:01-27

the mplfinance chart will only display years when the dates of the data are crossing different years (here 2014-2015) like:

enter image description here

otherwise, the dates on the chart will look like:

enter image description here

how to make the year information always be displayed on the chart?

CodePudding user response:

Use kwarg datetime_format= when calling mpf.plot(). So, for example, to get the format that you described above, do:

mpf.plot(df,...,datetime_format="%Y-%b-%d")

See all of the available format codes here: https://strftime.org/

  • Related