I am trying to plot a time series plot with plotly's 'lines+markers' mode although I was successful in plotting both lines and markers with some columns , I am unsuccessful for few columns and on those few columns only 'markers' mode works, but the data type of all these columns are float64.

Below is the snippet of code being used

trace = go.Scatter(x=df.index, y=df['some_column'], mode='lines+markers', name='some_column',line=dict(width=0.5,color='red'),marker=dict(size=2, opacity=0.5),showlegend=False) 
fig = py.tools.make_subplots(rows=1, cols=1) 
fig.append_trace(trace, 1, 1) fig['layout'].update(title = 'some title' ) ;
py.offline.plot(fig, filename=strFilename + str(v) + '.html')

I found that there are missing values in those columns in which 'lines+markers' is not working Any solution on how to tackle the missing data?

1 Answers

1
Moses Soleman On

I found the answer from https://community.plot.ly/t/missing-line-in-mode-lines/11429/4 Apparently due to the missing gaps I have to use connectgaps=True

So the code should be like

trace = go.Scatter(x=df.index, y=df['some_column'], mode='lines+markers', connectgaps= True,name='some_column',line=dict(width=0.5,color='red'),marker=dict(size=2, opacity=0.5),showlegend=False) 
fig = py.tools.make_subplots(rows=1, cols=1) 
fig.append_trace(trace, 1, 1) fig['layout'].update(title = 'some title' ) ;
py.offline.plot(fig, filename=strFilename + str(v) + '.html')

Thanks for your interest