Skip to content
Merged
Changes from 2 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
15 changes: 10 additions & 5 deletions plotly_resampler/figure_resampler/figure_resampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,16 @@ def show_dash(

# 2. Run the app
if (
self.layout.height is not None
and mode == "inline"
mode == "inline"
and "height" not in kwargs
):
# If figure height is specified -> re-use is for inline dash app height
kwargs["height"] = self.layout.height + 18
# If app height is not specified -> re-use figure height for inline dash app
# Note: default layout height is 450 (whereas default app height is 650)
# See: https://plotly.com/python/reference/layout/#layout-height
fig_height = self.layout.height if self.layout.height is not None else 450
kwargs["height"] = fig_height + 18

# store the app information, so it can be killed
# Store the app information, so it can be killed
self._app = app
self._host = kwargs.get("host", "127.0.0.1")
self._port = kwargs.get("port", "8050")
Expand Down Expand Up @@ -238,3 +240,6 @@ def register_update_graph_callback(
dash.dependencies.Input(graph_id, "relayoutData"),
prevent_initial_call=True,
)(self.construct_update_data)

def _ipython_display_(self):
return self.show_dash(mode="inline")