-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
px.timeline loses type of x_end values #2934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Here's what happens inside process_dataframe_timeline: plotly.py/packages/python/plotly/plotly/express/_core.py Lines 1608 to 1609 in fe7a5d5
x_end is overwritten internally, so downstream references to x_end result in the 'massaged' data instead of the original data |
Related to/duplicate of #2518 ... it seems like at the moment, using |
OK, so I have a fix for the For now, the workaround for import plotly.express as px
import pandas as pd
df = pd.DataFrame([
dict(Task="Job A", Start='2009-01-01', Finish='2009-02-28', Resource="Alex"),
dict(Task="Job B", Start='2009-03-05', Finish='2009-04-15', Resource="Alex"),
dict(Task="Job C", Start='2009-02-20', Finish='2009-05-30', Resource="Max")
])
fig = px.timeline(df, x_start="Start", x_end="Finish", y="Task", text=df["Finish"].copy())
fig.update_yaxes(autorange="reversed")
fig.show() |
While px.timeline uses x_end values as expected and creates the proper graph,
trying to display the x_end values either as text or as hoverdata fails
The text was updated successfully, but these errors were encountered: