atompy.get_axes_tightbbox_inch#

atompy.get_axes_tightbbox_inch(ax=None, renderer=None)[source]#

Get bounding box of ax including labels in inches.

Wrapper function for matplotlib.axes.Axes.get_tightbbox() which converts it to inches.

Parameters:
axmatplotlib.axes.Axes, optional

If None, use last active axes.

renderermatplotlib.backend_bases.RendererBase, optional

The renderer used to draw the figure.

Generally not necessary to pass it. If, however, you use a backend that takes a long time to render (e.g., a LuaLaTeX pgf backend), it may increase performance by passing the renderer. Use get_renderer() to get your current renderer.

Returns:
bboxmatplotlib.transforms.Bbox

The bounding box of ax including x/ylabels, titles, etc, in inches.

Useful members:

bbox.x0, bbox.x1

Location of the left and right edge in inches. Negative values are left of the figure left edge.

bbox.y0, bbox.y1

Lower and upper edge in inches. Negative values are below the figure bottom edge.

bbox.width, bbox.height

Width and height of the ax, including labels, titles, etc.

Notes

This ignores text elements added to ax. In particular, this means if you used add_abc() to add labels outside of the graph-area of ax, the dimensions returned by get_axes_tightbbox_inch will not include those.