matplotlib / matplotlib/mplfinance

Support for ununiformly spaced data

Open
#393 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
4.4k
Forks
678
PR merge metrics
No merged PRs in 30d

Description

Hello,

Today I tried to plot data for which the time column was not uniformly spaced, there is the result:

mpl-bug

Corresponding data:

                         Open      High       Low     Close        Volume
Date                                                                     
2021-01-10 16:43:50       NaN       NaN       NaN       NaN      0.000000
2021-01-10 16:49:40       NaN       NaN       NaN       NaN      0.000000
2021-01-10 16:57:28  0.339755  0.339755  0.339755  0.339755   2489.423910
2021-01-10 17:05:17  0.337448  0.337448  0.334059  0.334627  15050.000000
2021-01-10 17:10:20  0.335243  0.336025  0.335243  0.336025   3213.676925
2021-01-10 17:17:21  0.336025  0.336025  0.324992  0.324992  28470.776438
2021-01-10 17:24:09  0.326430  0.326905  0.326430  0.326905   1989.542713
2021-01-10 17:31:11       NaN       NaN       NaN       NaN      0.000000
2021-01-10 17:36:33  0.323282  0.324741  0.318373  0.323247  46563.285561
2021-01-10 17:43:19  0.323247  0.328985  0.323247  0.328985  19099.188282
2021-01-10 17:50:08       NaN       NaN       NaN       NaN      0.000000
2021-01-10 17:54:13       NaN       NaN       NaN       NaN      0.000000
2021-01-10 18:00:22  0.335203  0.336286  0.334394  0.334394  26723.586340
2021-01-10 18:07:07  0.333296  0.333296  0.331800  0.331800   6210.287422
2021-01-10 18:14:16  0.334205  0.334205  0.334205  0.334205   5037.527533
2021-01-10 18:21:39  0.333101  0.333101  0.333101  0.333101   1308.452131
2021-01-10 18:28:06  0.331582  0.331582  0.331582  0.331582   5000.000000
2021-01-10 18:34:04  0.328742  0.328742  0.328742  0.328742   6832.647206
2021-01-10 18:42:57  0.330514  0.330514  0.330514  0.330514   6000.000000
2021-01-10 18:49:21       NaN       NaN       NaN       NaN      0.000000

We can see two problems:

  • The candles' widths are not proportional to the duration of each row.
  • The volumes widths are not proportional to the duration of each row, and worse, the volume bars may overlap with their neighbors.

It would be nice to be able to handle this case natively with mplfinance.

Note: The use case is to inspect transactions inside blocks in a given blockchain (e.g. Bitcoin, Ethereum). The mining time is not constant.

Thank you!

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

The issue provides example data and an image but names no source file, test, or entry point. Start by locating the candle and volume plotting code, then define tests covering widths proportional to irregular time intervals and preventing neighboring volume bars from overlapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
matplotlib, python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.