# Hovermode, Custom by like factor

**URL:** <https://community.plotly.com/t/hovermode-custom-by-like-factor/59295>\
**Category:** Plotly R\
**Created:** [December 15, 2021, 7:04am UTC](https://community.plotly.com/t/hovermode-custom-by-like-factor/59295 "2021-12-15T07:04:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![krocco](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@krocco](https://community.plotly.com/u/krocco)\
**Post date:** [December 15, 2021, 7:04am UTC](https://community.plotly.com/t/hovermode-custom-by-like-factor/59295/1 "2021-12-15T07:04:58Z")

</div>

I’d like hover tooltips to highlight all points on a scatterplot which share equal values in a particular column of the referenced dataframe.

That is, rather than reference x, y distances, I’d like comparative rollover highlighting to function based on a ‘label’ to the points. Does anyone know a method to achieve this? Could the “distance” between points be faked programmatically?

---

<div class="post-metadata">

**Author:** ![ismirsehregal](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ismirsehregal/32/6794_2.png) [@ismirsehregal](https://community.plotly.com/u/ismirsehregal)\
**Post date:** [January 4, 2022, 12:35pm UTC](https://community.plotly.com/t/hovermode-custom-by-like-factor/59295/2 "2022-01-04T12:35:36Z")

</div>

I’m not entirely sure what your desired output is but maybe you are looking for `layout(hovermode = "y unified")`?

> **[Hover Text And Formatting](https://plotly.com/r/hover-text-and-formatting/#unified-hovermode)**
>
> How to use hover text and formatting in R with Plotly.

---

<div class="post-metadata">

**Author:** ![krocco](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@krocco](https://community.plotly.com/u/krocco)\
**Post date:** [January 6, 2022, 10:05pm UTC](https://community.plotly.com/t/hovermode-custom-by-like-factor/59295/3 "2022-01-06T22:05:52Z")

</div>

I’d like to have two datapoints linked by a common label or factor so that when I rollover one, I can see its “twin” highlighted, regardless of where it is. That is, the x and y values of the twin may be near or far, but I’d like to see it highlighted anyway.

The use case is comparing course of study offerings between campuses. If I mouse over ECON101 for campus A, I’d like to see the campus B datapoint highlighted at the same time.

---

<div class="post-metadata">

**Author:** ![ismirsehregal](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/ismirsehregal/32/6794_2.png) [@ismirsehregal](https://community.plotly.com/u/ismirsehregal)\
**Post date:** [January 6, 2022, 10:40pm UTC](https://community.plotly.com/t/hovermode-custom-by-like-factor/59295/4 "2022-01-06T22:40:44Z")

</div>

Sounds like a Job for [crosstalk](https://plotly-r.com/client-side-linking.html).

---

<div class="post-metadata">

**Author:** ![krocco](https://avatars.discourse-cdn.com/v4/letter/k/5e9695/32.png) [@krocco](https://community.plotly.com/u/krocco)\
**Post date:** [January 6, 2022, 11:25pm UTC](https://community.plotly.com/t/hovermode-custom-by-like-factor/59295/5 "2022-01-06T23:25:58Z")

</div>

Thanks for the tip, I’ll have a look.
