How to skip empty dates (weekends) in a financial

2020-01-30 09:06发布

ax.plot_date((dates, dates), (highs, lows), '-')

I'm currently using this command to plot financial highs and lows using Matplotlib. It works great, but how do I remove the blank spaces in the x-axis left by days without market data, such as weekends and holidays?

I have lists of dates, highs, lows, closes and opens. I can't find any examples of creating a graph with an x-axis that show dates but doesn't enforce a constant scale.

7条回答
Root(大扎)
2楼-- · 2020-01-30 09:50

I think you need to "artificially synthesize" the exact form of plot you want by using xticks to set the tick labels to the strings representing the dates (of course placing the ticks at equispaced intervals even though the dates you're representing aren't equispaced) and then using a plain plot.

查看更多
登录 后发表回答