visbrain.gui.Figure¶
- class visbrain.gui.Figure(files, path=None, grid=None, figtitle=None, y=1.02, titles=None, xlabels=None, ylabels=None, figsize=None, subspace={'bottom': 0.1, 'hspace': 0.3, 'left': 0.05, 'right': 1.0, 'top': 0.9, 'wspace': 0.0}, rmax=True, fig_bgcolor=None, ax_bgcolor=None, text_color='black', autocrop=False, autoresize=False)[source][source]¶
Automatically arange pictures in a grid and save a paper ready figure.
This class can be used to generate figures to be then used in a paper. For example, if you export 10 pictures, you may want to concatenate them in a (5, 2) grid and add a colorbar.
- Parameters:
- filesstr/list/tuple
Files to load. If it’s a string, only one file will be loaded. Otherwise, if files is a iterable object of strings (list, tuple) all the files will be loaded.
- pathstr | None
Specify where files are located. If all files are in separate folders, use the files variable : files = [‘path1/file1.png’, ‘path2/file2.jpg’, …]. If all pictures are in the same folder, use path=’path2myfolder/’ and files=[‘file1.png’, ‘file2.jpg’, …]
- gridtuple | None
Tuple of integers describing how to arange figures. The grid describe (n_rows, n_columns) of the final figure. If grid is None all pictures will be displayed on a line. For example, if 12 pictures are loaded, grid could be (6, 2), (4, 3)…
- figtitlestr | None
Title of the entire figure.
- yfloat | 1.02
Distance between top and title of each axis (if title displayed).
- titlesstr/list/tuple | None
Specify the title of each figure. If titles is None, no title will be added. If titles is a string, the same title will be applied to all figures. If titles is a list/tuple of strings, the strings inside will be used to set the title of each picture independantly (must have the same length as files.)
- xlabelsstr/list/tuple | None
Specify the x-axis label of each figure. If xlabels is None, no label will be added. If xlabels is a string, the same label will be applied to all figures. If xlabels is a list/tuple of strings, the strings inside will be used to set the label of each picture independantly (must have the same length as files.)
- ylabelsstr/list/tuple | None
Specify the y-axis label of each figure. If ylabels is None, no label will be added. If ylabels is a string, the same label will be applied to all figures. If ylabels is a list/tuple of strings, the strings inside will be used to set the label of each picture independantly (must have the same length as files.)
- figsizetuple | None
The size of the figure. Should be a tuple of integers.
- subspacedict | {}
Control margins and the distance between subplots. By default : {‘left’: 0., ‘right’: 1., ‘bottom’: 0., ‘top’: .9, ‘wspace’: 0., ‘hspace’: 0.05}. Use:
‘left’ (default 0.): left side of subplots
‘right’ (default 1.): right side of subplots
‘bottom’ (default 0.): bottom side of subplots
‘top’ (default .9): top of subplots
‘hspace’ (default .05): amount of height reserved for white space between subplots, expressed as a fraction of the average axis height.
‘wspace’ (default 0.): amount of width reserved for blank space between subplots, expressed as a fraction of the average axis width.
- rmaxbool | True
Remove borders of each axis.
- fig_bgcolorstr/tuple/list | None
Background color of the figure. By default, no background is used.
- ax_bgcolorstr/tuple/list | None
Background color of each axis. If None, no background will be used. If ax_bgcolor is a string, the same background will be used for all axes. Finally, use a list of colors to control the background color of each axis. This is a very important parameter for transparent pictures (like png or tiff files).
- text_colorstr/tuple/list | ‘black’
Color of text elements (figure title, axes titles, x and y labels.)
- autocropbool | False
Specify if each picture has to be automatically cropped.
- autoresizebool | False
Specify if all pictures have to be resized. If True, all pictures will be resized according to the minimum size along row axis. For further controls, define autoresize as a dictionary. Use the key ‘axis’ to specify if pictures have to share the same height (0) or width (1). Use ‘extend’ if the smallest (False) or the largest have to be considered as the reference.