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:
DisplayObjectEmbed 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 toIPython.display.SVGExamples
>>> 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.AxesImageAn 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_FORMATSfor interactive andDEFAULT_FORMATS_SPHINXwhen the environment variableSPHINX_MAKE_TARGETis set (such as the documentation make targets).