🏥 🏭 Working on the COVID-19 response in Canada? Plotly & the Canadian government can help you and your organization. Learn more and get in touch.

Arrows in a scatter plot

Hi,

I’m making a simple scatter plot like:

import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot

latt_x = [0, 1, 1.3, 0.5]
latt_y = [0, 1, 0.1, 1.8]
trace = go.Scatter(x = latt_x, y = latt_y, mode = 'markers',
                marker = dict(size = 20, color = 'rgba(0, 0, 0, 1)',
                line = dict(width = 2, color = 'rgb(0, 0, 0)')),
)
iplot([trace])

Is it possible to draw an arrow between two specific points in the scatter plot?

Thanks,

Adriaan

You can use an arrow annotation for this task: https://plot.ly/python/text-and-annotations/#styling-and-coloring-annotations

I think that what the original poster wanted (or at least what I want) is arrows between points in the scatterplot, not annotations on a single points. Imagine a scatterplot where the mode is markers and lines, but you need those lines to actually be arrows.

I need that capability also. I would draw a line from Point A to Point B and from Point C to Point A and such. Does Dash has such line styles?

With the direction 'From" or “To”, not just connecting the points.

Following pengchuzhang and avuik, I’d also like to know how to draw lines between points. Especially if it’s possible to do so when hovering over or clicking on a point.

I’m trying to visualize points and their nearest neighbors across 1K+ points, so I don’t want lines everywhere, except when hovered over or clicked on.

I would also like to be able to do this. Is there some new possibility for doing this?