matplotlib / matplotlib/mplfinance

How to change xtick positions and labels

Open
#428 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement question
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:
![image](https://user-images.githubusercontent.com/38225029/128413235-6f86f88f-8946-4562-96cf-f1a4cf581cb4.png)

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.