Skip to content

Support for ununiformly spaced data #393

Open
@fxmarty

Description

@fxmarty

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions