Skip to content

Commit 1a7b5c6

Browse files
committed
Refactor Dash app initialization to use dash.Dash instead of JupyterDash
1 parent 8d6e882 commit 1a7b5c6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

edisgo/tools/plots.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
from typing import TYPE_CHECKING
77

8+
import dash
89
import matplotlib
910
import numpy as np
1011
import pandas as pd
1112
import plotly.graph_objects as go
1213

1314
from dash import dcc, html
1415
from dash.dependencies import Input, Output
15-
from jupyter_dash import JupyterDash
1616
from matplotlib import pyplot as plt
1717
from networkx import Graph
1818
from pyproj import Transformer
@@ -1513,9 +1513,9 @@ def plot_dash_app(
15131513
edisgo_objects: EDisGo | dict[str, EDisGo],
15141514
debug: bool = False,
15151515
height: int = 500,
1516-
) -> JupyterDash:
1516+
) -> dash.Dash:
15171517
"""
1518-
Generates a jupyter dash app from given eDisGo object(s).
1518+
Generates a dash app from given eDisGo object(s).
15191519
15201520
Parameters
15211521
----------
@@ -1538,8 +1538,8 @@ def plot_dash_app(
15381538
15391539
Returns
15401540
-------
1541-
JupyterDash
1542-
Jupyter dash app.
1541+
Dash
1542+
dash app.
15431543
15441544
"""
15451545
if isinstance(edisgo_objects, dict):
@@ -1586,7 +1586,7 @@ def plot_dash_app(
15861586

15871587
padding = 1
15881588

1589-
app = JupyterDash(__name__)
1589+
app = dash.Dash(__name__)
15901590
# Workaround to use standard python logging with plotly dash
15911591
if debug:
15921592
app.logger.disabled = False
@@ -2216,7 +2216,7 @@ def plot_dash(
22162216
height: int = 820,
22172217
):
22182218
"""
2219-
Shows the generated jupyter dash app from given eDisGo object(s).
2219+
Shows the generated dash app from given eDisGo object(s).
22202220
22212221
Parameters
22222222
----------
@@ -2236,16 +2236,16 @@ def plot_dash(
22362236
Plotting in own browser tab.
22372237
22382238
debug : bool
2239-
If True, enables debugging of the jupyter dash app.
2239+
If True, enables debugging of the dash app.
22402240
22412241
port : int
22422242
Port which the app uses. Default: 8050.
22432243
22442244
height : int
2245-
Height of the jupyter dash cell.
2245+
Height of the dash cell.
22462246
22472247
"""
22482248
app = plot_dash_app(edisgo_objects, debug=debug, height=height - 300)
22492249
log = logging.getLogger("werkzeug")
22502250
log.setLevel(logging.ERROR)
2251-
app.run_server(mode=mode, debug=debug, height=height, port=port)
2251+
app.run(mode=mode, debug=debug, height=height, port=port)

0 commit comments

Comments
 (0)