kay
kay

Reputation: 415

how to make the mplfinance charts always display years

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?

Upvotes: 1

Views: 133

Answers (1)

Daniel Goldfarb
Daniel Goldfarb

Reputation: 7714

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/

Upvotes: 2

Related Questions