Skip to content

Commit 53d486a

Browse files
committed
add mathjax and topojson config options
1 parent 720ada5 commit 53d486a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

plotly/io/_defaults.py

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ def __init__(self):
1111
self.default_width = 700
1212
self.default_height = 500
1313
self.default_scale = 1
14+
self.mathjax = None
15+
self.topojson = None
1416

1517

1618
defaults = _Defaults()

plotly/io/_kaleido.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def as_path_object(file: Union[str, Path]) -> Union[Path, None]:
173173
return path
174174

175175

176-
def infer_format(path: Path | None, format: str | None) -> str | None:
176+
def infer_format(path: Union[Path, None], format: Union[str, None]) -> Union[str, None]:
177177
if path is not None and format is None:
178178
ext = path.suffix
179179
if ext:
@@ -344,6 +344,8 @@ def to_image(
344344
height=height or defaults.default_height,
345345
scale=scale or defaults.default_scale,
346346
),
347+
topojson=Path(defaults.topojson).as_uri() if defaults.topojson else None,
348+
# mathjax=Path(defaults.mathjax).as_uri() if defaults.mathjax else None,
347349
)
348350
except choreographer.errors.ChromeNotFoundError:
349351
raise RuntimeError(PLOTLY_GET_CHROME_ERROR_MSG)
@@ -608,6 +610,8 @@ def write_images(
608610
height=d["height"] or defaults.default_height,
609611
scale=d["scale"] or defaults.default_scale,
610612
),
613+
"topojson": Path(defaults.topojson).as_uri() if defaults.topojson else None,
614+
# "mathjax": Path(defaults.mathjax).as_uri() if defaults.mathjax else None,
611615
}
612616
for d in arg_dicts
613617
]

0 commit comments

Comments
 (0)