Skip to content

Time Series xaxis ticks in 3.2.0 #1190

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

Closed
sursu opened this issue Sep 21, 2018 · 2 comments
Closed

Time Series xaxis ticks in 3.2.0 #1190

sursu opened this issue Sep 21, 2018 · 2 comments

Comments

@sursu
Copy link
Contributor

sursu commented Sep 21, 2018

I have the following dataframe:

DD = pd.DataFrame({'Intervals':np.random.randint(30, size=1000)})
DD['Date'] = pd.Timestamp.today() + pd.to_timedelta(DD['Intervals'],'h').cumsum()
DD['Duration'] = np.random.normal(size=len(DD))

I try to make a time series plot as shown here:

trace = go.Scatter(x=DD['Date'], y=DD['Duration'],
                   mode='lines+markers', 
                   marker=dict(size = 4),
                   line=dict(width = 0.8))
layout = go.Layout(yaxis=dict(title='Seconds'),
                   height=700
                  )
fig = go.Figure([trace], layout=layout)
iplot(fig, show_link=False)

Output:
newplot 2

Notice how the xaxis ticks are not in a datetime format.

Specifying the x as x=DD['Date'].dt.date resolves the issue.
But this solution does not work if I use go.FigureWidget().
And, it is wrong, as it can be seen if I were to use 's' instead of 'h' as the unit in pd.to_timedelta().


I use Jupyter Lab. The same happens in Jupyter Notebooks.
This issue did not exist previously (e.g. in 3.1.2).

@jonmmease
Copy link
Contributor

Hi @sursu , I think you're running into #1160, which was fixed in 3.2.1. Can you try updating and see if that takes care of it?

@sursu
Copy link
Contributor Author

sursu commented Sep 21, 2018

Yes, that solved it 👍

@sursu sursu closed this as completed Sep 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants