Skip to content

Allow grouped tooltips for plots with multiple univariate geoms #1460

@IKupriyanov-HORIS

Description

@IKupriyanov-HORIS
import numpy as np
import pandas as pd
from lets_plot import *
LetsPlot.setup_html()

np.random.seed(42)
n = 80
x1 = np.linspace(0, 10, n)
y1 = 1.0 + 0.7 * x1 + np.random.normal(scale=1.8, size=n)
df1 = pd.DataFrame({"x": x1, "y": y1})

x2 = np.linspace(0, 10, n)
y2 = 18.0 - 0.4 * x2 + np.random.normal(scale=2.0, size=n)
df2 = pd.DataFrame({"x": x2, "y": y2})

ggplot() + \
    geom_point(data=df1, mapping=aes("x", "y"), color='red', alpha=0.5, tooltips='none') + \
    geom_smooth(data=df1, mapping=aes("x", "y"), color='red') + \
    geom_point(data=df2, mapping=aes("x", "y"), color='blue', alpha=0.5, tooltips='none') + \
    geom_smooth(data=df2, mapping=aes("x", "y"), color='blue')
Image

Expected result:
Both lines have tooltips.

From discussion.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions