Skip to content

Commit 47900a5

Browse files
authored
fix: DH-18685: Remove top margin from chart (#1126)
Plotly Express adds a top margin that I have now removed. Fixes [DH-18685](https://deephaven.atlassian.net/issues/DH-18685?jql=ORDER%20BY%20created%20DESC) ``` from deephaven import empty_table, ui from deephaven.plot import express as dx t = empty_table(10).update(["x=i", "y=i"]) p = dx.line(t, x="x", y="y", title="Title") p2 = dx.line(t, x="x", y="y") ``` [DH-18685]: https://deephaven.atlassian.net/browse/DH-18685?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 3df6ffe commit 47900a5

53 files changed

Lines changed: 16 additions & 75 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

plugins/plotly-express/src/deephaven/plot/express/deephaven_figure/generate.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,14 @@ def generate_figure(
10671067
extra_generators=[hover_text],
10681068
)
10691069

1070+
# px adds a margin of 60 if a title is not specified
1071+
# since most charts still use px at their core and
1072+
# this isn't user controlled in any way, remove it after
1073+
# the figure is already created
1074+
px_fig.update_layout(
1075+
margin_t=None,
1076+
)
1077+
10701078
dh_fig = DeephavenFigure(
10711079
px_fig,
10721080
call_args=call_args,

plugins/plotly-express/test/deephaven/plot/express/plots/test_area.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def test_basic_area(self):
6969
"side": "left",
7070
},
7171
"legend": {"tracegroupgap": 0},
72-
"margin": {"t": 60},
7372
}
7473

7574
self.assertEqual(plotly["layout"], expected_layout)
@@ -134,7 +133,6 @@ def test_area_step(self):
134133
"side": "left",
135134
},
136135
"legend": {"tracegroupgap": 0},
137-
"margin": {"t": 60},
138136
}
139137

140138
self.assertEqual(plotly["layout"], expected_layout)
@@ -191,7 +189,6 @@ def test_area_pandas(self):
191189
"side": "left",
192190
},
193191
"legend": {"tracegroupgap": 0},
194-
"margin": {"t": 60},
195192
}
196193

197194
expected_mappings = [

plugins/plotly-express/test/deephaven/plot/express/plots/test_bar.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def test_basic_bar_x(self):
5555
expected_layout = {
5656
"barmode": "relative",
5757
"legend": {"tracegroupgap": 0},
58-
"margin": {"t": 60},
5958
"xaxis": {
6059
"anchor": "y",
6160
"domain": [0.0, 1.0],
@@ -121,7 +120,6 @@ def test_basic_bar_y(self):
121120
expected_layout = {
122121
"barmode": "relative",
123122
"legend": {"tracegroupgap": 0},
124-
"margin": {"t": 60},
125123
"xaxis": {
126124
"anchor": "y",
127125
"domain": [0.0, 1.0],
@@ -187,7 +185,6 @@ def test_basic_bar_x_y(self):
187185
expected_layout = {
188186
"barmode": "relative",
189187
"legend": {"tracegroupgap": 0},
190-
"margin": {"t": 60},
191188
"xaxis": {
192189
"anchor": "y",
193190
"domain": [0.0, 1.0],

0 commit comments

Comments
 (0)