Figure

class Figure(html_template)[source]

Data structure for wrapping, displaying and exporting a JavaScript figure.

display(inline=False)[source]

Display the plot in a webbrowser or as IPython rich display representation.

Parameters

inline (bool) – If True, the plot will be shown inline in a Jupyter notebook.

to_html()[source]

Create a HTML text representation.

to_html_standalone()[source]

Create a standalone HTML text representation that has all javascript code embedded.

to_html_partial()[source]

Create a dependent HTML text representation that loads javascript with require.js.

to_jpg(webdriver='chrome', capture_delay=3.5)[source]

Create a JPEG text representation with base64 text encoding the binary data.

to_png(webdriver='chrome', capture_delay=3.5)[source]

Create a PNG text representation with base64 text encoding the binary data.

to_svg(webdriver='chrome', capture_delay=3.5)[source]

Create a SVG text representation.

export_html(filepath, overwrite=False)[source]

Export the plot as HTML file.

Parameters
  • filepath (str) – Filepath for the generated HTML file.

  • overwrite (bool) – If True, overwrite the file if it already exists.

Raises

FileExistsError – If overwrite=False and there is already a file at the given filepath.

export_svg(filepath, overwrite=False, webdriver='chrome', capture_delay=3.5)[source]

Export the plot as SVG file.

Parameters
  • filepath (str) – Filepath for the generated SVG file.

  • overwrite (bool) – If True, overwrite the file if it already exists.

Raises

FileExistsError – If overwrite=False and there is already a file at the given filepath.

export_png(filepath, overwrite=False, webdriver='chrome', capture_delay=3.5)[source]

Export the plot as PNG file.

Parameters
  • filepath (str) – Filepath for the generated PNG file.

  • overwrite (bool) – If True, overwrite the file if it already exists.

Raises

FileExistsError – If overwrite=False and there is already a file at the given filepath.

export_jpg(filepath, overwrite=False, webdriver='chrome', capture_delay=3.5)[source]

Export the plot as JPEG file.

Parameters
  • filepath (str) – Filepath for the generated JPEG file.

  • overwrite (bool) – If True, overwrite the file if it already exists.

Raises

FileExistsError – If overwrite=False and there is already a file at the given filepath.