Say I have a pandas DataFrame
object that looks like this:
df.info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 232 entries, 2017-08-20 14:30:22 to 2017-08-21 10:08:02
Data columns (total 1 columns):
S_dw 232 non-null float64
dtypes: float64(1)
memory usage: 3.6 KB
If I pass this df to go.Scatterplot
and produce data
as data = [go.Scatter(x=df.index, y=df[variable])]
, then py.iplot(data)
generates a plotly plot with the correct x-axis of dates:
But the same df
used in an app.callback
function of Dash yields an empty graph and an x-axis with integer values. The y-axis is correctly scaled in both cases, and axis titles update, so I know the app.callback
is working fine.
I’ve tried this a few different ways, and verified that the x-axis plots if I just use x=np.arange(len(df))
in Dash. I’m not getting any errors, so can’t debug this further. Any advice or suggestions would be really helpful.