sizing
full name:
mplotter.sizing
type: module
Adjusting the size of matplotlib figures.
When preparing complex documents consisting of text and visual elements, it is often crucial to:
Fit a figure in a specific region of the document.
Avoid any rescaling of the figure upon inclusion, so that its fixed size components (e.g. text elements) are preserved.
To this aim,
It might be convenient to use the size of other layout elements of the document (line width, slide height, etc.) as length units.
It is necessary to ensure that a figure is sized accurately.
This module provides helper functions to achieve both these goals. Precisely,
The function
fig_size()
allows to use the values (in inches) inrcParams['figure.figsize']
(default:[6.4, 4.8]
) as custom width and height units, converting a length specified in these units to its value in inches (standard matplotlib’s unit). The latter can then be used as input elsewhere.When typesetting a TeX document, the size (in pt) of many layout elements can be assessed including the command
\showthe\<somelength>
and inspecting the compiler log;<somelength>
is the name of the layout element (for a list of common possibilities see this table). To convert the output to inches, simply divide by72.27
.The function
get_fig_size()
retrives the save-time size of a figure (for a specific backend). Calling this function iteratively,set_fig_size()
attemps to enforce a given save-time size for a figure, adjusting its draw-time size. Often only one of thBuilt-in support is available only for a handful of vector formats, listed in
SUPPORTED_FORMATS
. For other file formats, extra dependencies are required (seeEXTRAS_FORMATS
).
Attributes
Supported file formats by |
|
Optional supported file formats by |
|
Maximum number of sizing attempts by |
|
Relative tolerance of |
Functions
|
Converts |
|
Measures the actual saved figure size. |
|
Sets the actual saved figure size. |