cellxgene icon indicating copy to clipboard operation
cellxgene copied to clipboard

[FEATURE REQUEST] Hovering over cells displays a tooltip when coloring by categorical labels

Open atarashansky opened this issue 3 years ago • 6 comments

With many clusters, it may be hard to determine visually which color in the category sidebar corresponds to which color in the scatter plot. This is especially true for the color-impaired.

I'd really like to see a plotly-esque feature where hovering over a cell gives you a tooltip reporting the identity of that cell.

See here for how plotly does it: image You can't see my mouse but it was right next to the little left-facing arrow on the tooltip.

The way plotly deals with this is by snapping the tooltip to the nearest cell based on euclidean distance within a certain radius. So, if there are cells within X distance to your mouse's current location, the tooltip snaps to the nearest cell. This also handles cases where you have multiple cells overlapping because no two cells will have the same exact coordinates anyway. The only problem is that the spatially closest cell may not be most sensible to show the tooltip for because it could be on the bottom z-plane.

An alternative solution could be to show a summary tooltip of the number of cells under your mouse, and the distribution of labels (e.g. there are 5 of cell type A, 6 of cell type B, and 10 of cell type C within a circle of radius X around your mouse's current location). When coloring by categorical labels, you could draw a faint circle around the mouse to make it even more clear what chunk of the manifold the tooltip is corresponding to.

For continuous labels, you could report the actual expression value of the hovered cell if using the snapping approach. If using the latter summary tooltip approach, you could report the average expression (with standard deviation) under your mouse.

atarashansky avatar Jun 29 '21 22:06 atarashansky

Hello!

I decided to take a crack at this myself. See the attached screen capture for a demonstration. Would there be interest in a PR for this?

https://user-images.githubusercontent.com/16548075/125674652-4f252327-8ea2-4009-9cf2-02ab59f533e3.mov

atarashansky avatar Jul 14 '21 18:07 atarashansky

Pinging @colinmegill

atarashansky avatar Jul 14 '21 18:07 atarashansky

Here's a demo of a slightly more polished version:

https://user-images.githubusercontent.com/16548075/125687972-fc0e3b3f-4fef-47c8-b7bf-fbc80fd0fa9f.mov

atarashansky avatar Jul 14 '21 20:07 atarashansky

Hey @atarashansky apologies for not getting to the initial feature request, but so glad you pursued it further - this is very cool!

To follow up - you are using this tool tip to get a more concrete sense of the cluster(s) that a group of cells belongs to - you mentioned the ambiguity of relying solely on color, but is this problem also addressed by displaying the names of the categories (clusters) over the centroid of the cluster?

I like the numerical summaries that you are demoing in the second video - could you expand a little bit more on the use case that is being served here?

MaximilianLombardo avatar Jul 14 '21 22:07 MaximilianLombardo

I don’t think the centroids overlay are enough, especially when the density of points is extremely high and clusters are mixed (see #1457 for more detailed discussions).

The numerical summaries are also aiding the color impaired in being able to discern the expression values of the cells they are hovering over. More generally, this tool also gives a fast way to see what the average expression is of a cluster of cells (along with any other statistics users might be interested in). The average may not be clear visually if there is a lot of variability of expression within a cluster (e.g due to dropout or other sources of variation).

atarashansky avatar Jul 15 '21 05:07 atarashansky