question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

px.timeline chart incorrectly displays timeframes of 10 seconds and smaller.

See original GitHub issue

The following piece of python code that uses a ISO-formatted date string produces the graph below.

import plotly.express as px
import pandas as pd

bars = pd.DataFrame([{'Task': 'kitter_pick', 'Start': '2020-07-22T23:09:18.221013', 'Finish': '2020-07-22T23:09:25.221013', 'Counter': 2465}])

fig = px.timeline(bars, x_start="Start", x_end="Finish", y="Task",hover_name='Counter')
fig.update_yaxes(autorange="reversed")  # otherwise tasks are listed from the bottom up
fig.show()

result The snippet is similar to https://plotly.com/python/time-series/ from the plotly documentation.

The timescale is completely incorrect due to the finish attribute being incorrectly interpreted by plotly.

When changing the timestrings slightly you obtain the correct result:

bars = pd.DataFrame([{'Task': 'kitter_pick', 'Start': '2020-07-22T23:09:18.221013', 'Finish': '2020-07-22T23:10:25.221013', 'Counter': 2465}])

correct result

Does anybody know why this happens and if there is a way around this?

I have also tried:

  • datetime.datetime objects
  • np.datetime64 objects

Both gave the same results

stackoverflow link

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolaskruchtencommented, Sep 8, 2020

Fixed on master.

1reaction
nicolaskruchtencommented, Aug 11, 2020

Should be fixed in the next version of plotly, within 10 days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotly px.timeline not working with specific combinations of ...
However, this issue was resolved in plotly release 4.11 (px.timeline chart incorrectly displays timeframes of 10 seconds and smaller.
Read more >
Plotly Express timeline for Gantt Chart with integer xaxis?
The answer: Yes, it's possible! Just give integers as start and end "dates", calculate the difference between them ( delta ), and make...
Read more >
Change the timescale in a Project view in Project desktop
Display a view with a timescale, such as the Gantt Chart. Click View > Timescale box arrow. Timescale box on the View tab....
Read more >
Visualization: Column Chart - Google Developers
Like all Google charts, column charts display tooltips when the user hovers over the data. For a horizontal version of this chart, see...
Read more >
Year 2000 problem - Wikipedia
The year 2000 problem, also known as the Y2K problem, Y2K scare, millennium bug, Y2K bug, Y2K glitch, Y2K error, or simply Y2K...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found