# Arrows in a scatter plot

**URL:** <https://community.plotly.com/t/arrows-in-a-scatter-plot/470>\
**Category:** Plotly Fundamentals\
**Created:** [February 4, 2016, 3:59pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470 "2016-02-04T15:59:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![avuik](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/avuik/32/115_2.png) [@avuik](https://community.plotly.com/u/avuik)\
**Post date:** [February 4, 2016, 3:59pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/1 "2016-02-04T15:59:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [February 4, 2016, 4:12pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/2 "2016-02-04T16:12:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![steremma](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@steremma](https://community.plotly.com/u/steremma)\
**Post date:** [August 31, 2018, 11:14am UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/3 "2018-08-31T11:14:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pengchuzhang](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pengchuzhang](https://community.plotly.com/u/pengchuzhang)\
**Post date:** [June 11, 2019, 8:08pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/4 "2019-06-11T20:08:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pengchuzhang](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@pengchuzhang](https://community.plotly.com/u/pengchuzhang)\
**Post date:** [June 11, 2019, 8:08pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/5 "2019-06-11T20:08:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![madman](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@madman](https://community.plotly.com/u/madman)\
**Post date:** [July 24, 2019, 4:37pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/6 "2019-07-24T16:37:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![F\_E](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@F\_E](https://community.plotly.com/u/F_E)\
**Post date:** [February 4, 2020, 4:26pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/7 "2020-02-04T16:26:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![54321lalalalala](https://avatars.discourse-cdn.com/v4/letter/5/a9adbd/32.png) [@54321lalalalala](https://community.plotly.com/u/54321lalalalala)\
**Post date:** [March 14, 2021, 7:49am UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/8 "2021-03-14T07:49:05Z")

</div>

+1 on this  
…

---

<div class="post-metadata">

**Author:** ![pflotley](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@pflotley](https://community.plotly.com/u/pflotley)\
**Post date:** [March 24, 2021, 9:48pm UTC](https://community.plotly.com/t/arrows-in-a-scatter-plot/470/9 "2021-03-24T21:48:18Z")

</div>

I also wonder what the answer is to this question is.
