sdynpy.doc.sdynpy_latex.figure
- figure(figures, figure_label=None, figure_caption=None, graphics_options='width=0.7\\linewidth', animate_graphics_options='width=0.7\\linewidth,loop', figure_placement='', subfigure_options='[t]{0.45\\linewidth}', subfigure_labels=None, subfigure_captions=None, max_subfigures_per_page=None, max_subfigures_first_page=None, figure_save_names=None, latex_root='')[source]
Adds figures, subfigures, and animations to a running latex document.
- Parameters
figures (list) – Figure or figures that can be inserted into a latex document. See note for various figure types and configurations that can be used.
figure_label (str, optional) – The label that will be used for the figure in the latex document. If not specified, the figure will not be labeled.
figure_caption (str, optional) – The caption that will be used for the figure in the latex document. If not specified, the figure will only be captioned with the figure number.
graphics_options (str, optional) – Graphics options that will be used for the figure. If not specified this will be r’width=0.7linewidth’.
animate_graphics_options (str, optional) – Graphics options that will be used for an animation. If not specified this will be r’width=0.7linewidth,loop’.
figure_placement (str, optional) – Specify the placement of the figure with strings such as ‘[t]’, ‘[b]’, or ‘[h]’. If not specified, the figure will have no placement specified.
subfigure_options (str, optional) – The options that will be applied to each subfigure in the figure, if subfigures are specified. By default, this will be r’[t]{0.45linewidth}’
subfigure_labels (str, optional) – Labels to apply to the subfigure. This can either be a list of strings the same size as the list of figures, or a string with a format specifier accepting the subfigure index. If not specified, the subfigures will not be labeled.
subfigure_captions (list, optional) – A list of strings the same length as the list of figures to use as captions for the subfigures. If not specified, the subfigures will only be captioned with the subfigure number.
max_subfigures_per_page (int, optional) – The maximum number of subfigures on a page. Longer figures will be broken up into multiple figures using ContinuedFloat. If not specified, a single figure environment will be generated.
max_subfigures_first_page (int, optional) – The maximum number of subfigures on the first page. Longer figures will be broken up into multiple figures using ContinuedFloat. If not specified, the max_subfigures_per_page value will be used if specified, otherwise a single figure environment will be generated.
figure_save_names (str or list of str, optional) – File names to save the figures as. This can be specified as a string with a format specifier in it that will accept the figure index, or a list of strings the same length as the list of figures. If not specified, files will be specified as ‘figure_0’, ‘figure_1’, etc. If file names are not present, then the file name will be automatically selected for the type of figure given.
latex_root (str, optional) – Directory in which the latex .tex file will be constructed. This is used to create relative paths to the save_figure_names within the latex document. If not specified, then the current directory will be assumed.
- Returns
latex_string – The latex source code to insert the figures into the document.
- Return type
str
Notes
The figures argument must be a list of figures. If only one entry is present in the list, a figure will be made in the latex document. If multiple entries are present, a figure will be made and subfigures will be made for each entry in the list. If an entry in the list is also a list, then that figure or subfigure will be made into an animation.
The list of figures can contain many types of objects that a figure will be made from, including:
A 2D numpy array
A Matplotlib figure
A pyqtgraph plotitem
A bytes object that represents an image
A string to a file name