finesse.plotting.tools module

finesse.plotting.tools.DEFAULT_FORMATS = ('svg',)

Default image format for IPython output

finesse.plotting.tools.DEFAULT_FORMATS_SPHINX = ('pdf', 'svg')

Default image formats for sphinx builds, where we need both pdf (for latexpdf) and svg (for html) output.

class finesse.plotting.tools.PDFSVG(pdf_bytes: bytes, svg_bytes: bytes)[source]

Bases: DisplayObject

Embed both a PDF and an SVG into the display.

Implements a class that embeds both a PDF and SVG version of the data in the same object, by implementing the _repr_mimebundle_() method for both mime-types ‘application/pdf’ and ‘image/svg+xml’.

It can be used with IPython.display.display() similar to IPython.display.SVG

Examples

>>> display(PDFSVG(pdfbytes, svgbytes))

References

https://ipython.readthedocs.io/en/9.17.1/config/integrating.html#more-powerful-methods

finesse.plotting.tools.add_colorbar(im, **kwargs)[source]

Adds a vertical color bar to an image plot.

Parameters

im : matplotlib.image.AxesImage

An image plot, e.g. return value of a call to plt.imshow().

Returns

Handle to the colorbar.

finesse.plotting.tools.init(mode='display', dpi=None, fmts=None)[source]

Sets up default plotting parameters for a desired display mode.

Parameters

modestr

Display mode to use, either ‘display’ or ‘paper’.

dpiint, optional

DPI (Dots per inch) to display and save figures with. Defaults to current setting.

fmtslist of str, optional

List of image formats to allow for display when running under IPython; defaults to DEFAULT_FORMATS for interactive and DEFAULT_FORMATS_SPHINX when the environment variable SPHINX_MAKE_TARGET is set (such as the documentation make targets).