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

Tooltip for a line have higher priority than points, even if the point is specified first in the layer list

Open INekrasova-HORIS opened this issue 1 year ago • 0 comments

Tooltip for a line have higher priority than points, even if the point is specified first in the layer list

image

import numpy as np
import pandas as pd
from lets_plot import *
LetsPlot.setup_html()
n = 100
classes = ['a', 'b', 'c']
np.random.seed(42)
x = np.random.normal(size=n)
y = np.random.normal(size=n)
c = np.random.choice(classes, size=n)
df = pd.DataFrame({'x': x, 'y': y, 'c': c})
bounds_df = pd.DataFrame([(cl, df[df.c == cl].y.max()) for cl in classes], \
                         columns=['c', 'ymax'])
ggplot() + \
        geom_point(aes(x='x', y='y', color='c'), data=df, tooltips=layer_tooltips().line("@x")) + \
        geom_hline(aes(yintercept='ymax', color='c'), data=bounds_df, size=.7, linetype='longdash') 

INekrasova-HORIS avatar Mar 22 '24 13:03 INekrasova-HORIS