Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marginal-distribution subplots include overall-trendline #4669

Open
JonNir1 opened this issue Jul 17, 2024 · 0 comments
Open

marginal-distribution subplots include overall-trendline #4669

JonNir1 opened this issue Jul 17, 2024 · 0 comments
Labels
bug something broken P3 not needed for current cycle

Comments

@JonNir1
Copy link

JonNir1 commented Jul 17, 2024

When creating a scatter plot with marginal distributions and an overall trendline (but not trace trendline), the trendline is shown on all three subplots instead of only the main one.
See related StackOverflow question with suggested workarounds.
Repro code:

import numpy as np
import pandas as pd
import plotly.io as pio
import plotly.express as px

pio.renderers.default = "browser"

np.random.seed(42)
data = pd.DataFrame(np.random.randint(0, 100, (100, 4)), columns=["feature1", "feature2", "feature3", "feature4"])
data["label"] = np.random.choice(list("ABC"), 100)
data["is_outlier"] = np.random.choice([True, False], 100)

fig = px.scatter(
    data, x="feature1", y="feature2",
    color="label", symbol="is_outlier", symbol_map={True: "x", False: "circle"},
    log_x=False, marginal_x="box",
    log_y=False, marginal_y="box",
    trendline="ols", trendline_scope="overall", trendline_color_override='black',
    trendline_options=dict(log_x=False, log_y=False),
)
fig.show()

fig1

@gvwilson gvwilson assigned gvwilson and unassigned gvwilson Jul 26, 2024
@gvwilson gvwilson added P3 not needed for current cycle bug something broken labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

2 participants