Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6837831

Browse files
committed
support setting plotly.js path
1 parent1d6d3bc commit6837831

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

‎plotly/io/_defaults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

1819
defaults=_Defaults()

‎plotly/io/_kaleido.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,12 @@ def to_image(
369369
fromkaleido.errorsimportChromeNotFoundError
370370

371371
try:
372+
kopts= {}
373+
ifdefaults.plotlyjs:
374+
kopts["plotlyjs"]=defaults.plotlyjs
375+
ifdefaults.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=scaleordefaults.default_scale,
380386
),
381387
topojson=defaults.topojson,
382-
kopts=(
383-
dict(
384-
mathjax=defaults.mathjax,
385-
)
386-
ifdefaults.mathjax
387-
elseNone
388-
),
388+
kopts=kopts,
389389
)
390390
exceptChromeNotFoundError:
391391
raiseRuntimeError(PLOTLY_GET_CHROME_ERROR_MSG)
@@ -692,15 +692,14 @@ def write_images(
692692
fromkaleido.errorsimportChromeNotFoundError
693693

694694
try:
695+
kopts= {}
696+
ifdefaults.plotlyjs:
697+
kopts["plotlyjs"]=defaults.plotlyjs
698+
ifdefaults.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-
ifdefaults.mathjax
702-
elseNone
703-
),
702+
kopts=kopts,
704703
)
705704
exceptChromeNotFoundError:
706705
raiseRuntimeError(PLOTLY_GET_CHROME_ERROR_MSG)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp