matplotlib / matplotlib/mplfinance
How to change xtick positions and labels
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 678
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to make a simple Intraday (5m) chart and I'm having a bit of trouble with the xlabels when I don't have a complete dataset:

I'm generating the graph using `mpf.plot(df, ...)`. I've figured out how to make the xlims static from market open to close, but I'd like the labels to be uniformly spaced in 30m intervals and appear even where there is no data (in the morning, only a few xticks are shown). How can I do this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the mpf.plot call and trace how x-axis limits, tick positions, and labels are generated for incomplete intraday data. The work is done when 30-minute labels are uniformly spaced across the market-open-to-close range, including intervals with no data, and the chart behavior is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- matplotlib, python
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100