Skip to content

API

Python API

convert_figure(fig) -> ConversionResult

Converts a Matplotlib Figure and returns:

  • document: pont.ink document object
  • session: pont.ink session object
  • warnings: list of conversion warnings

figure_to_document(fig) -> dict

Returns only the pont.ink document.

figure_to_session(fig) -> dict

Returns only the pont.ink session envelope.

figure_to_document_file(fig, output_path, indent=2) -> ConversionResult

Writes a document JSON file.

figure_to_session_file(fig, output_path, indent=2) -> ConversionResult

Writes a session JSON file.

export_figure_file(fig, output_path, ...) -> ConversionResult

Exports an image file from Matplotlib and optionally embeds pont.ink document metadata.

Key options:

  • export_format: explicit format override (otherwise inferred from file extension)
  • dpi: output DPI override
  • include_edit_remark: defaults to True
  • edit_remark_text: defaults to Edit this plot on pont.ink!
  • embed_document: defaults to True

CLI

Convert pickled Figure to session JSON

pontink-export figure.pkl out.pontink.json

Convert pickled Figure to document JSON

pontink-export figure.pkl out.document.json --document

Export image with embedded document metadata

pontink-export figure.pkl out.svg
pontink-export figure.pkl out.png --no-edit-remark
pontink-export figure.pkl out.pdf --dpi 300
pontink-export figure.pkl out.eps

CLI flags

  • --document: write document-only JSON
  • --indent N: JSON indentation (default 2)
  • --format: force image format
  • --dpi: set image DPI
  • --no-embed-document: skip embedding pont.ink document metadata
  • --no-edit-remark: disable default footer remark
  • --edit-remark-text: custom footer text