lets-plot icon indicating copy to clipboard operation
lets-plot copied to clipboard

Suboptimal tooltip positioning in facets

Open orausch opened this issue 1 year ago • 1 comments

I often have plots with many tooltips, and the current overflowing behavior makes these a bit tricky to use. Example:

from lets_plot import *

LetsPlot.setup_html()

d = {
    l: [i]*3 for i, l in enumerate(string.ascii_lowercase)
    
} | {'facet': [0, 1, 2]}
ggplot(d, aes(x='a', y='b')) + geom_point(tooltips=layer_tooltips(list(string.ascii_lowercase))) + ggsize(300, 1000) + facet_wrap('facet')

The lower tooltips have enough space to display:

Screenshot 2024-09-16 at 8 24 28 AM

The upper ones overflow even though there is space for them: Screenshot 2024-09-16 at 8 24 37 AM

orausch avatar Sep 16 '24 15:09 orausch

Likely related: #1043

alshan avatar Oct 01 '24 16:10 alshan

We attempted to prevent overlap between tooltips (e.g., the axis tooltip 0.0 forced the general tooltip to align at the top).

In the fix, I relaxed the overlapping restriction. Now, the general tooltip can overlap other tooltips (e.g., the axis tooltip becomes hidden in such cases). This leaves room for improvements, such as using a semi-transparent general tooltip or assigning a higher z-order to axis tooltips.

Output with the fix: image

IKupriyanov-HORIS avatar Nov 28 '24 20:11 IKupriyanov-HORIS