matplotlib / matplotlib/mplfinance

`tz_localize=True` fails to localize datetimes in `tlines` and `alines` specifications (and in the future also in xlim specification?)

Open
#314 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi, I tried to implement the tlines using mplfinance, and generate the trendline data as per the example, however, I still get this error:

ValueError:
tlines date pair (2021-01-11 09:35:00-05:00,2021-01-11 10:20:00-05:00) too close, or wrong order, or out of range!
df date range: [2021-01-11 09:35:00+00:00 , 2021-01-11 10:20:00+00:00]

Please, if anyone can advise, It will be much appreciated.

Regards.

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 by reproducing the reported error with timezone-aware datetimes in the tlines and alines specifications, using the example referenced in the issue. Inspect how tz_localize=True is handled for these specifications, and verify that the date pair is accepted when its timezone differs from the dataframe range; xlim behavior is noted as future work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
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.