PX Scatter - Overlapping hover bug?

Hello,

I’m trying to do a very simple scatter plot (3 points), but I’m seeing a strange issue. The points all happen to be overlapping. Whenever I change the “color=” to a different value, some of the points go missing when I hover, even though they are not missing (i.e. not nan) in the data. Here’s the data:

	personIdExternal	lastName	firstName	company	Overall Performance Rating	Wgtd Score
0	1234			Sokol		Billy		LMFG	4				100
1	5678			Rundle		Barney		ELEC	4				100
2	9101			Andrews		Sammy		ELEC	4				100

Here is my code and result when working correctly:

fig = px.scatter(dfResigs, x="Wgtd Score", y="Overall Performance Rating",  color='lastName', 
                 hover_data=['lastName', 'company'])                
fig.update_layout(hovermode='x', showlegend=False, width=500, autosize=False)
fig.show()

Correct

And here is the issue. Just changing the color attribute:

fig = px.scatter(dfResigs, x="Wgtd Score", y="Overall Performance Rating",  color='company', 
                 hover_data=['lastName', 'company'])                
fig.update_layout(hovermode='x', showlegend=False, width=500, autosize=False)
fig.show()

Incorrect

In truth, there will ultimately be more points to this dataset, so the “color” attribute will make sense to use in the final version, but for this post I’ve isolated to the three problem points. Any help on why this hover isn’t showing all three points when I change the color argument?

Only one hoverlabel is ever shown per trace (at any given time), and in your second example you have two traces, one of which has two points, so you only see two labels.

That makes total sense. I guess I didn’t remember that when I was using “lastName” it was creating many traces, and the company example I was creating fewer.

Thanks for the response!