File tree Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Expand file tree Collapse file tree 2 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ def __init__(self):
1313 self .default_scale = 1
1414 self .mathjax = None
1515 self .topojson = None
16+ self .plotlyjs = None
1617
1718
1819defaults = _Defaults ()
Original file line number Diff line number Diff line change @@ -369,6 +369,12 @@ def to_image(
369369 from kaleido .errors import ChromeNotFoundError
370370
371371 try :
372+ kopts = {}
373+ if defaults .plotlyjs :
374+ kopts ["plotlyjs" ] = defaults .plotlyjs
375+ if defaults .mathjax :
376+ kopts ["mathjax" ] = defaults .mathjax
377+
372378 # TODO: Refactor to make it possible to use a shared Kaleido instance here
373379 img_bytes = kaleido .calc_fig_sync (
374380 fig_dict ,
@@ -379,13 +385,7 @@ def to_image(
379385 scale = scale or defaults .default_scale ,
380386 ),
381387 topojson = defaults .topojson ,
382- kopts = (
383- dict (
384- mathjax = defaults .mathjax ,
385- )
386- if defaults .mathjax
387- else None
388- ),
388+ kopts = kopts ,
389389 )
390390 except ChromeNotFoundError :
391391 raise RuntimeError (PLOTLY_GET_CHROME_ERROR_MSG )
@@ -692,15 +692,14 @@ def write_images(
692692 from kaleido .errors import ChromeNotFoundError
693693
694694 try :
695+ kopts = {}
696+ if defaults .plotlyjs :
697+ kopts ["plotlyjs" ] = defaults .plotlyjs
698+ if defaults .mathjax :
699+ kopts ["mathjax" ] = defaults .mathjax
695700 kaleido .write_fig_from_object_sync (
696701 kaleido_specs ,
697- kopts = (
698- dict (
699- mathjax = defaults .mathjax ,
700- )
701- if defaults .mathjax
702- else None
703- ),
702+ kopts = kopts ,
704703 )
705704 except ChromeNotFoundError :
706705 raise RuntimeError (PLOTLY_GET_CHROME_ERROR_MSG )
You can’t perform that action at this time.
0 commit comments