Skip to content

Commit 3135c11

Browse files
author
Sarah Krebs
committed
Save plotly plots in higher resolution
1 parent a835f52 commit 3135c11

File tree

14 files changed

+72
-13
lines changed

14 files changed

+72
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Add exit button which first deletes running jobs and then terminates DeepCave.
1212
- Nicer handling of Keyboard Interrupt.
1313
- Disable debug mode.
14+
- Save plotly plots in higher resolution upon download.
1415

1516
## Bug-Fixes
1617
- Fix missing objective specification in LPI evaluator (#71).
@@ -19,6 +20,7 @@
1920
- Reset inputs to fix error when subsequently selecting runs with different configspaces, objectives or budgets (#106).
2021
- Fix errors due to changing inputs before runselection (#64).
2122
- For fANOVA, remove constant hyperparameters from configspace (#9).
23+
- For PCP, show hyperparameters with highest importance closest to the cost (i.e. right).
2224

2325
## Version-Updates
2426
- Black version from 23.1.0 to 23.3.0

deepcave/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Config:
5656
SAVE_IMAGES = False # The figure will be saved to the cache directory.
5757
FIGURE_MARGIN = dict(t=30, b=0, l=0, r=0)
5858
FIGURE_HEIGHT = "40vh"
59+
FIGURE_DOWNLOAD_SCALE = 4.0
5960

6061
# Redis settings
6162
REDIS_PORT: int = 6379

deepcave/plugins/budget/budget_correlation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,11 @@ def get_output_layout(register: Callable) -> List[Any]:
220220
[
221221
dbc.Tab(
222222
dcc.Graph(
223-
id=register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT}
223+
id=register("graph", "figure"),
224+
style={"height": Config.FIGURE_HEIGHT},
225+
config={
226+
"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}
227+
},
224228
),
225229
label="Graph",
226230
),

deepcave/plugins/hyperparameter/importances.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,11 @@ def get_output_layout(register: Callable) -> dcc.Graph:
354354
dcc.Graph
355355
Layout for the output block.
356356
"""
357-
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})
357+
return dcc.Graph(
358+
register("graph", "figure"),
359+
style={"height": Config.FIGURE_HEIGHT},
360+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
361+
)
358362

359363
@staticmethod
360364
def load_outputs(run, inputs, outputs) -> go.Figure: # type: ignore

deepcave/plugins/hyperparameter/pdp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,11 @@ def get_output_layout(register: Callable) -> dcc.Graph:
365365
dcc.Graph
366366
Layout for the output block.
367367
"""
368-
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})
368+
return dcc.Graph(
369+
register("graph", "figure"),
370+
style={"height": Config.FIGURE_HEIGHT},
371+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
372+
)
369373

370374
@staticmethod
371375
def get_pdp_figure( # type: ignore

deepcave/plugins/hyperparameter/symbolic_explanations.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,16 @@ def get_output_layout(register: Callable) -> List[dcc.Graph]:
490490
Layout for the output block.
491491
"""
492492
return [
493-
dcc.Graph(register("symb_graph", "figure"), style={"height": Config.FIGURE_HEIGHT}),
494-
dcc.Graph(register("pdp_graph", "figure"), style={"height": Config.FIGURE_HEIGHT}),
493+
dcc.Graph(
494+
register("symb_graph", "figure"),
495+
style={"height": Config.FIGURE_HEIGHT},
496+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
497+
),
498+
dcc.Graph(
499+
register("pdp_graph", "figure"),
500+
style={"height": Config.FIGURE_HEIGHT},
501+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
502+
),
495503
]
496504

497505
@staticmethod

deepcave/plugins/objective/configuration_cube.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,13 @@ def get_output_layout(register: Callable) -> Tuple[dcc.Graph,]:
293293
Tuple[dcc.Graph,]
294294
Layout for the output block.
295295
"""
296-
return (dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT}),)
296+
return (
297+
dcc.Graph(
298+
register("graph", "figure"),
299+
style={"height": Config.FIGURE_HEIGHT},
300+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
301+
),
302+
)
297303

298304
@staticmethod
299305
def load_outputs(run, inputs, outputs) -> go.Figure: # type: ignore

deepcave/plugins/objective/cost_over_time.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ def get_output_layout(register: Callable) -> dcc.Graph:
274274
dcc.Graph
275275
The layouts for the output block.
276276
"""
277-
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})
277+
return dcc.Graph(
278+
register("graph", "figure"),
279+
style={"height": Config.FIGURE_HEIGHT},
280+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
281+
)
278282

279283
@staticmethod
280284
def load_outputs(runs, inputs, outputs) -> go.Figure: # type: ignore

deepcave/plugins/objective/parallel_coordinates.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,9 @@ def process(run, inputs) -> Dict[str, Any]: # type: ignore
298298
evaluator.calculate(objective, budget, n_trees=10, seed=0)
299299
importances_dict = evaluator.get_importances()
300300
importances = {u: v[0] for u, v in importances_dict.items()}
301-
important_hp_names = sorted(importances, key=lambda key: importances[key], reverse=True)
301+
important_hp_names = sorted(
302+
importances, key=lambda key: importances[key], reverse=False
303+
)
302304
result["important_hp_names"] = important_hp_names
303305

304306
return result
@@ -319,7 +321,11 @@ def get_output_layout(register: Callable) -> dcc.Graph:
319321
dcc.Graph
320322
The layouts for the output block.
321323
"""
322-
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})
324+
return dcc.Graph(
325+
register("graph", "figure"),
326+
style={"height": Config.FIGURE_HEIGHT},
327+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
328+
)
323329

324330
@staticmethod
325331
def load_outputs(run, inputs, outputs) -> go.Figure: # type: ignore

deepcave/plugins/objective/pareto_front.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,11 @@ def get_output_layout(register: Callable) -> dcc.Graph:
328328
dcc.Graph
329329
The layout for the output block.
330330
"""
331-
return dcc.Graph(register("graph", "figure"), style={"height": Config.FIGURE_HEIGHT})
331+
return dcc.Graph(
332+
register("graph", "figure"),
333+
style={"height": Config.FIGURE_HEIGHT},
334+
config={"toImageButtonOptions": {"scale": Config.FIGURE_DOWNLOAD_SCALE}},
335+
)
332336

333337
@staticmethod
334338
def load_outputs(runs, inputs, outputs) -> go.Figure: # type: ignore

0 commit comments

Comments
 (0)