save_html

save_html(
    plot=None
    file=None
    *
    lib_dir='lib'
    include_version=True
    data_in_svg=True
    use_cdn=None
)

Save a MAIDR plot as HTML file.

Parameters

Name Type Description Default
plot Any or None The plot object to save. Supports matplotlib/seaborn artists, Plotly figures, and Altair chart objects. If None, uses the current matplotlib figure. None
file str The file path where to save the HTML. Required; may be passed positionally, as in maidr.save_html(plot, "output.html"), the form the getting-started tutorial uses and the form :meth:Maidr.save_html and its Plotly and Altair counterparts take. None
lib_dir str or None Directory name for libraries. "lib"
include_version bool Whether to include version information. True
data_in_svg bool Controls where the MAIDR JSON payload is placed in the HTML or SVG. True
use_cdn bool, {"auto"}, or None * True: reference the public jsDelivr CDN only (no files copied, no offline fallback). * False: bundle maidr.js and its assets into lib_dir next to the saved HTML and reference the script with a relative path. The resulting directory is self-contained and works without any network access. * "auto": copy the bundle alongside the HTML and emit a CDN loader with a client-side onerror fallback, so the HTML works both online and offline. This is the default mode. * None (default): use the process-wide default (see :func:set_use_cdn / MAIDR_USE_CDN). Both default to "auto". The two CDN modes (True and "auto") resolve the published version over the network once per process when building the URL, bounded by MAIDR_CDN_TIMEOUT; MAIDR_CDN_VERSION skips it. False makes no request. Altair charts always use the CDN — this argument is not plumbed through that adapter. None

Returns

Name Type Description
str The path to the saved HTML file.

Raises

Name Type Description
TypeError If file is not given.