File tree 2 files changed +14
-14
lines changed 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ def __init__(self):
13
13
self .default_scale = 1
14
14
self .mathjax = None
15
15
self .topojson = None
16
+ self .plotlyjs = None
16
17
17
18
18
19
defaults = _Defaults ()
Original file line number Diff line number Diff line change @@ -369,6 +369,12 @@ def to_image(
369
369
from kaleido .errors import ChromeNotFoundError
370
370
371
371
try :
372
+ kopts = {}
373
+ if defaults .plotlyjs :
374
+ kopts ["plotlyjs" ] = defaults .plotlyjs
375
+ if defaults .mathjax :
376
+ kopts ["mathjax" ] = defaults .mathjax
377
+
372
378
# TODO: Refactor to make it possible to use a shared Kaleido instance here
373
379
img_bytes = kaleido .calc_fig_sync (
374
380
fig_dict ,
@@ -379,13 +385,7 @@ def to_image(
379
385
scale = scale or defaults .default_scale ,
380
386
),
381
387
topojson = defaults .topojson ,
382
- kopts = (
383
- dict (
384
- mathjax = defaults .mathjax ,
385
- )
386
- if defaults .mathjax
387
- else None
388
- ),
388
+ kopts = kopts ,
389
389
)
390
390
except ChromeNotFoundError :
391
391
raise RuntimeError (PLOTLY_GET_CHROME_ERROR_MSG )
@@ -692,15 +692,14 @@ def write_images(
692
692
from kaleido .errors import ChromeNotFoundError
693
693
694
694
try :
695
+ kopts = {}
696
+ if defaults .plotlyjs :
697
+ kopts ["plotlyjs" ] = defaults .plotlyjs
698
+ if defaults .mathjax :
699
+ kopts ["mathjax" ] = defaults .mathjax
695
700
kaleido .write_fig_from_object_sync (
696
701
kaleido_specs ,
697
- kopts = (
698
- dict (
699
- mathjax = defaults .mathjax ,
700
- )
701
- if defaults .mathjax
702
- else None
703
- ),
702
+ kopts = kopts ,
704
703
)
705
704
except ChromeNotFoundError :
706
705
raise RuntimeError (PLOTLY_GET_CHROME_ERROR_MSG )
You can’t perform that action at this time.
0 commit comments