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

fix: strip plots now show up with default colors #919

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,16 @@ def create_figure(self) -> DeephavenFigure:

figs.append(fig)

if "strip" in self.groups:
# Normally, strip plots are created by creating a box plot then hiding the boxes
# with a rgba line color with alpha set to 0.
# This conflicts with our theming since we remove the point color,
# which then inherits the transparent line color instead of the layout colorway
# color where our theme colors are set.
# Instead, we remove the line color and hide the box with a line width of 0.
for fig in figs:
fig.get_plotly_fig().update_traces(line_color=None, line_width=0)

try:
layered_fig = atomic_layer(*figs, which_layout=0)
except ValueError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
STRIP_DEFAULTS,
HISTOGRAM_DEFAULTS,
SPREAD_GROUPS,
STRIP_GROUPS,
)


Expand Down Expand Up @@ -449,7 +450,7 @@ def shared_strip(is_marginal: bool = True, **args: Any) -> DeephavenFigure:
set_all(args, STRIP_DEFAULTS)

func = px.strip
groups = SPREAD_GROUPS
groups = STRIP_GROUPS

return shared_marginal(is_marginal, func, groups, **args)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@
}

SPREAD_GROUPS = {"marker", "preprocess_spread", "supports_lists"}

STRIP_GROUPS = SPREAD_GROUPS | {"strip"}
Original file line number Diff line number Diff line change
Expand Up @@ -2624,7 +2624,7 @@ def test_basic_strip_x(self):
"hoveron": "points",
"hovertemplate": "X=%{x}<extra></extra>",
"legendgroup": "",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636efa"},
"name": "",
"offsetgroup": "",
Expand Down Expand Up @@ -2739,7 +2739,7 @@ def test_basic_strip_x_y(self):
"hoveron": "points",
"hovertemplate": "X=%{x}<br>Y=%{y}<extra></extra>",
"legendgroup": "",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636efa"},
"name": "",
"offsetgroup": "",
Expand Down Expand Up @@ -2809,7 +2809,7 @@ def test_list_strip_x(self):
"hoveron": "points",
"hovertemplate": "variable=X<br>value=%{x}<extra></extra>",
"legendgroup": "X",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "X",
"offsetgroup": "variable0",
Expand All @@ -2830,7 +2830,7 @@ def test_list_strip_x(self):
"hoveron": "points",
"hovertemplate": "variable=Y<br>value=%{x}<extra></extra>",
"legendgroup": "Y",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "Y",
"offsetgroup": "variable1",
Expand Down Expand Up @@ -2891,7 +2891,7 @@ def test_list_strip_y(self):
"hoveron": "points",
"hovertemplate": "variable=X<br>value=%{y}<extra></extra>",
"legendgroup": "X",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "X",
"offsetgroup": "variable0",
Expand All @@ -2912,7 +2912,7 @@ def test_list_strip_y(self):
"hoveron": "points",
"hovertemplate": "variable=Y<br>value=%{y}<extra></extra>",
"legendgroup": "Y",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "Y",
"offsetgroup": "variable1",
Expand Down Expand Up @@ -2973,7 +2973,7 @@ def test_list_strip_x_y(self):
"hoveron": "points",
"hovertemplate": "variable=X<br>value=%{x}<br>Y=%{y}<extra></extra>",
"legendgroup": "X",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "X",
"offsetgroup": "variable0",
Expand All @@ -2995,7 +2995,7 @@ def test_list_strip_x_y(self):
"hoveron": "points",
"hovertemplate": "variable=X2<br>value=%{x}<br>Y=%{y}<extra></extra>",
"legendgroup": "X2",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "X2",
"offsetgroup": "variable1",
Expand Down Expand Up @@ -3167,7 +3167,7 @@ def test_by_strip_x(self):
"hoveron": "points",
"hovertemplate": "category=1<br>X=%{x}<extra></extra>",
"legendgroup": "1",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "1",
"offsetgroup": "category0",
Expand All @@ -3188,7 +3188,7 @@ def test_by_strip_x(self):
"hoveron": "points",
"hovertemplate": "category=2<br>X=%{x}<extra></extra>",
"legendgroup": "2",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "2",
"offsetgroup": "category1",
Expand Down Expand Up @@ -3249,7 +3249,7 @@ def test_by_strip_y(self):
"hoveron": "points",
"hovertemplate": "category=1<br>Y=%{y}<extra></extra>",
"legendgroup": "1",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "1",
"offsetgroup": "category0",
Expand All @@ -3270,7 +3270,7 @@ def test_by_strip_y(self):
"hoveron": "points",
"hovertemplate": "category=2<br>Y=%{y}<extra></extra>",
"legendgroup": "2",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "2",
"offsetgroup": "category1",
Expand Down Expand Up @@ -3333,7 +3333,7 @@ def test_by_strip_x_y(self):
"hoveron": "points",
"hovertemplate": "category=1<br>X=%{x}<br>Y=%{y}<extra></extra>",
"legendgroup": "1",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "1",
"offsetgroup": "category0",
Expand All @@ -3355,7 +3355,7 @@ def test_by_strip_x_y(self):
"hoveron": "points",
"hovertemplate": "category=2<br>X=%{x}<br>Y=%{y}<extra></extra>",
"legendgroup": "2",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "2",
"offsetgroup": "category1",
Expand Down Expand Up @@ -3430,7 +3430,7 @@ def test_list_by_strip_x(self):
"hoveron": "points",
"hovertemplate": "category=1<br>value=%{x}<extra></extra>",
"legendgroup": "1",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "1",
"offsetgroup": "category0",
Expand All @@ -3451,7 +3451,7 @@ def test_list_by_strip_x(self):
"hoveron": "points",
"hovertemplate": "category=2<br>value=%{x}<extra></extra>",
"legendgroup": "2",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "2",
"offsetgroup": "category1",
Expand Down Expand Up @@ -3512,7 +3512,7 @@ def test_list_by_strip_y(self):
"hoveron": "points",
"hovertemplate": "category=1<br>Y=%{y}<extra></extra>",
"legendgroup": "1",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "1",
"offsetgroup": "category0",
Expand All @@ -3533,7 +3533,7 @@ def test_list_by_strip_y(self):
"hoveron": "points",
"hovertemplate": "category=2<br>Y=%{y}<extra></extra>",
"legendgroup": "2",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "2",
"offsetgroup": "category1",
Expand Down Expand Up @@ -3596,7 +3596,7 @@ def test_list_by_strip_x_y(self):
"hoveron": "points",
"hovertemplate": "category=1<br>value=%{x}<br>Y=%{y}<extra></extra>",
"legendgroup": "1",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636EFA"},
"name": "1",
"offsetgroup": "category0",
Expand All @@ -3618,7 +3618,7 @@ def test_list_by_strip_x_y(self):
"hoveron": "points",
"hovertemplate": "category=2<br>value=%{x}<br>Y=%{y}<extra></extra>",
"legendgroup": "2",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#EF553B"},
"name": "2",
"offsetgroup": "category1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def test_marginal_scatter(self):
"hovertemplate": "X=%{x}<extra></extra>",
"jitter": 0,
"legendgroup": "",
"line": {"color": "rgba(255,255,255,0)"},
"line": {"width": 0},
"marker": {"color": "#636efa", "symbol": "line-ns-open"},
"name": "",
"offsetgroup": "",
Expand Down
Loading