Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

Multiple line scatter for visualization of cell tracking with jupyter notebook

Hi guys,
I wonder if anyone know how to create interactive multiple line scatters using plotly with jupyter notebook?
I wanted something like this but with the interaction offered by plotly.

with colors indicates the tracks with final position toward a side.

Since there will be more than hundreds of tracks, does this mean that i will need to create traces for each track?

Thanks in advance if you can share some tips.

@davince As long as all your plots have the same type=‘scatter’ , you can define a function as follows:

def my_trace(x, y, **kwargs):# kwargs are keys you intend to set in the trace definition
    return dict(type='scatter',
                     x=x,
                     y=y,
                     mode='lines',
                     line=dict(width=your_width, color=your_color),
                     name='trace_name',
                  )

Analogously, define a function for layout:

xaxis_style=dict(...)#your preferences for x-axis style
yaxis_style=dict(...)

def my_layout(title='Corresponding title', **other_kwargs):
        return dict(title=title,
                         xaxis=xaxis_style,
                         yaxis=yaxis_style,
                         #other keys-values
                         hovermode='closest')

and call these functions to get data and layout for each plot.