Xobiwan
Xobiwan

Reputation: 57

mplFinance edit x-axis to show seconds

I am wondering if there is a way to have an MPLFinance plot show more keys(time) and seconds as well as minutes. I know you are able to add the minute, but can't find anywhere to add the seconds.

Upvotes: 3

Views: 911

Answers (1)

Daniel Goldfarb
Daniel Goldfarb

Reputation: 7714

You can tell mpf.plot() how you want to format the datetime axis using kwarg datetime_format=. You can use any valid strftime string.

For example, datetime_format='%b %d, %H:%M:%S' to show hours, minutes, and seconds (along with the month and day) for example, "Nov 3 14:53:15". Of course, the datetime index of your DataFrame must contain hours, minutes, and seconds, or they may show as zeros: "Nov 3 00:00:00".

Upvotes: 5

Related Questions