In order to produce multiple plots with consistent style it is useful to set
matplotlib options globally. One way to do this is by updating
rcParams inside a script, e.g.:
import matplotlib matplotlib.rcParams['font.family'] = 'sans-serif' matplotlib.rcParams['font.size'] = 9 # The size of saved figures depends on the figure size (w, h) and DPI matplotlib.rcParams['savefig.dpi'] = 300
tight_layout() functionality provides an easy way for plots to fill the available space, and most Eelbrain plots use it by default.
However, when trying to generate multiple figures with identical scaling it can lead to unwanted differences between figures.
For a consistent layout, set the font size through
rcParams, and then control the size of plots and figures using the corresponding parameters (
w, h, axw, axh).
Subplot placement can also be specified in absolute scale through the
margins parameter (see General layout parameters).
If a script produces several plots and there is no need to show them on the
screen, they can be kept hidden through the
p = plot.UTSStat('uts', 'A', ds=ds, w=5, tight=False, show=False)
When working on more complex figures, it is often desirable to save the legend separately and combine it in a layout application:
p = plot.UTSStat('uts', 'A', ds=ds, w=5, tight=False, show=False, legend=False) p.save('plot.pdf', transparent=True) p.save_legend('legend.pdf', transparent=True)