plotting sparce time with matplotlib

会有一股神秘感。 提交于 2021-02-08 08:21:46

问题


I want to plot a trading timeseries, e.g. close of 5 min bars. The markets are closed over night. So I have two queries:

How to plot time in MatPlotLib (as well as date). E.g. so I need to implement a new axis or new hourLocators etc.

How to remove overnight gaps from my plot. I.e. I want the last bar on Monday evening to be visually contiguous with the first bar of Tuesday morning. (Multiple plots won't work here as I need to display several days and pan the view.)


回答1:


Look at this example. It skips weekend gaps in a series of daily data and is very easy to adapt to your case.



来源:https://stackoverflow.com/questions/4152396/plotting-sparce-time-with-matplotlib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!