From 436b4c48aa93e6ff04625973f21bb76a5840a103 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Tue, 1 Oct 2024 14:25:26 -0500 Subject: [PATCH 1/2] wip --- .../deephaven/plot/express/plots/PartitionManager.py | 10 ++++++++++ .../src/deephaven/plot/express/plots/_private_utils.py | 3 ++- .../deephaven/plot/express/shared/distribution_args.py | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/PartitionManager.py b/plugins/plotly-express/src/deephaven/plot/express/plots/PartitionManager.py index 84f94dce5..77ad926ad 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/PartitionManager.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/PartitionManager.py @@ -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: diff --git a/plugins/plotly-express/src/deephaven/plot/express/plots/_private_utils.py b/plugins/plotly-express/src/deephaven/plot/express/plots/_private_utils.py index f09fd065b..9695305e9 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/plots/_private_utils.py +++ b/plugins/plotly-express/src/deephaven/plot/express/plots/_private_utils.py @@ -20,6 +20,7 @@ STRIP_DEFAULTS, HISTOGRAM_DEFAULTS, SPREAD_GROUPS, + STRIP_GROUPS, ) @@ -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) diff --git a/plugins/plotly-express/src/deephaven/plot/express/shared/distribution_args.py b/plugins/plotly-express/src/deephaven/plot/express/shared/distribution_args.py index 057b7459a..76e0a88e7 100644 --- a/plugins/plotly-express/src/deephaven/plot/express/shared/distribution_args.py +++ b/plugins/plotly-express/src/deephaven/plot/express/shared/distribution_args.py @@ -40,3 +40,5 @@ } SPREAD_GROUPS = {"marker", "preprocess_spread", "supports_lists"} + +STRIP_GROUPS = SPREAD_GROUPS | {"strip"} From e7afa8c6d81b660d63cba9457a94afdf4bc35e61 Mon Sep 17 00:00:00 2001 From: Joe Numainville Date: Tue, 1 Oct 2024 16:56:00 -0500 Subject: [PATCH 2/2] wip --- .../plot/express/plots/test_distribution.py | 40 +++++++++---------- .../plot/express/plots/test_scatter.py | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/plugins/plotly-express/test/deephaven/plot/express/plots/test_distribution.py b/plugins/plotly-express/test/deephaven/plot/express/plots/test_distribution.py index d452e5139..57c83d9a4 100644 --- a/plugins/plotly-express/test/deephaven/plot/express/plots/test_distribution.py +++ b/plugins/plotly-express/test/deephaven/plot/express/plots/test_distribution.py @@ -2624,7 +2624,7 @@ def test_basic_strip_x(self): "hoveron": "points", "hovertemplate": "X=%{x}", "legendgroup": "", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636efa"}, "name": "", "offsetgroup": "", @@ -2739,7 +2739,7 @@ def test_basic_strip_x_y(self): "hoveron": "points", "hovertemplate": "X=%{x}
Y=%{y}", "legendgroup": "", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636efa"}, "name": "", "offsetgroup": "", @@ -2809,7 +2809,7 @@ def test_list_strip_x(self): "hoveron": "points", "hovertemplate": "variable=X
value=%{x}", "legendgroup": "X", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "X", "offsetgroup": "variable0", @@ -2830,7 +2830,7 @@ def test_list_strip_x(self): "hoveron": "points", "hovertemplate": "variable=Y
value=%{x}", "legendgroup": "Y", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "Y", "offsetgroup": "variable1", @@ -2891,7 +2891,7 @@ def test_list_strip_y(self): "hoveron": "points", "hovertemplate": "variable=X
value=%{y}", "legendgroup": "X", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "X", "offsetgroup": "variable0", @@ -2912,7 +2912,7 @@ def test_list_strip_y(self): "hoveron": "points", "hovertemplate": "variable=Y
value=%{y}", "legendgroup": "Y", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "Y", "offsetgroup": "variable1", @@ -2973,7 +2973,7 @@ def test_list_strip_x_y(self): "hoveron": "points", "hovertemplate": "variable=X
value=%{x}
Y=%{y}", "legendgroup": "X", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "X", "offsetgroup": "variable0", @@ -2995,7 +2995,7 @@ def test_list_strip_x_y(self): "hoveron": "points", "hovertemplate": "variable=X2
value=%{x}
Y=%{y}", "legendgroup": "X2", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "X2", "offsetgroup": "variable1", @@ -3167,7 +3167,7 @@ def test_by_strip_x(self): "hoveron": "points", "hovertemplate": "category=1
X=%{x}", "legendgroup": "1", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "1", "offsetgroup": "category0", @@ -3188,7 +3188,7 @@ def test_by_strip_x(self): "hoveron": "points", "hovertemplate": "category=2
X=%{x}", "legendgroup": "2", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "2", "offsetgroup": "category1", @@ -3249,7 +3249,7 @@ def test_by_strip_y(self): "hoveron": "points", "hovertemplate": "category=1
Y=%{y}", "legendgroup": "1", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "1", "offsetgroup": "category0", @@ -3270,7 +3270,7 @@ def test_by_strip_y(self): "hoveron": "points", "hovertemplate": "category=2
Y=%{y}", "legendgroup": "2", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "2", "offsetgroup": "category1", @@ -3333,7 +3333,7 @@ def test_by_strip_x_y(self): "hoveron": "points", "hovertemplate": "category=1
X=%{x}
Y=%{y}", "legendgroup": "1", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "1", "offsetgroup": "category0", @@ -3355,7 +3355,7 @@ def test_by_strip_x_y(self): "hoveron": "points", "hovertemplate": "category=2
X=%{x}
Y=%{y}", "legendgroup": "2", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "2", "offsetgroup": "category1", @@ -3430,7 +3430,7 @@ def test_list_by_strip_x(self): "hoveron": "points", "hovertemplate": "category=1
value=%{x}", "legendgroup": "1", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "1", "offsetgroup": "category0", @@ -3451,7 +3451,7 @@ def test_list_by_strip_x(self): "hoveron": "points", "hovertemplate": "category=2
value=%{x}", "legendgroup": "2", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "2", "offsetgroup": "category1", @@ -3512,7 +3512,7 @@ def test_list_by_strip_y(self): "hoveron": "points", "hovertemplate": "category=1
Y=%{y}", "legendgroup": "1", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "1", "offsetgroup": "category0", @@ -3533,7 +3533,7 @@ def test_list_by_strip_y(self): "hoveron": "points", "hovertemplate": "category=2
Y=%{y}", "legendgroup": "2", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "2", "offsetgroup": "category1", @@ -3596,7 +3596,7 @@ def test_list_by_strip_x_y(self): "hoveron": "points", "hovertemplate": "category=1
value=%{x}
Y=%{y}", "legendgroup": "1", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636EFA"}, "name": "1", "offsetgroup": "category0", @@ -3618,7 +3618,7 @@ def test_list_by_strip_x_y(self): "hoveron": "points", "hovertemplate": "category=2
value=%{x}
Y=%{y}", "legendgroup": "2", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#EF553B"}, "name": "2", "offsetgroup": "category1", diff --git a/plugins/plotly-express/test/deephaven/plot/express/plots/test_scatter.py b/plugins/plotly-express/test/deephaven/plot/express/plots/test_scatter.py index 3f728acc0..9c7063317 100644 --- a/plugins/plotly-express/test/deephaven/plot/express/plots/test_scatter.py +++ b/plugins/plotly-express/test/deephaven/plot/express/plots/test_scatter.py @@ -644,7 +644,7 @@ def test_marginal_scatter(self): "hovertemplate": "X=%{x}", "jitter": 0, "legendgroup": "", - "line": {"color": "rgba(255,255,255,0)"}, + "line": {"width": 0}, "marker": {"color": "#636efa", "symbol": "line-ns-open"}, "name": "", "offsetgroup": "",