Skip to main content
`Ctrl`+`K`

# pyladoc.figure_to_string

pyladoc.figure_to_string(fig, unique_id, figure_format='svg', font_family=None, scale=1, alt_text='', base64=False)

  Converts a matplotlib figure to a ascii-string. For png base64 encoding is used in general, for svg base64 encoding can be enabled. For base64 encoded figures a img-tag is included in the output.

  Parameters:

    - fig (`None`) – The figure to convert

    - figure_format (`Literal`[`'svg'`, `'png'`, `'pgf'`]) – The format to save the figure in (svg, png or pgf)

    - font_family (`str` | `None`) – The font family to use for the figure

    - scale (`float`) – Scaling factor for the figure size

    - alt_text (`str`) – The alt text for the figure

    - base64 (`bool`) – If the format is svg this determine if the image is encode in base64

  Return type:

    `str`

  Returns:

    The figure as ascii-string