mpl_toolkits.mplot3d.axes3d.Axes3D.apply_aspect#

Axes3D.apply_aspect(position=None)[source]#

Adjust the Axes for a specified data aspect ratio.

Depending onget_adjustable this will modify either theAxes box (position) or the view limits. In the former case,get_anchor will affect the position.

Parameters:
positionNone or .Bbox

Note

This parameter exists for historic reasons and is consideredinternal. End users should not use it.

If notNone, this defines the position of theAxes within the figure as a Bbox. Seeget_positionfor further details.

See also

matplotlib.axes.Axes.set_aspect

For a description of aspect ratio handling.

matplotlib.axes.Axes.set_adjustable

Set how the Axes adjusts to achieve the required aspect ratio.

matplotlib.axes.Axes.set_anchor

Set the position in case of extra space.

matplotlib.figure.Figure.draw_without_rendering

Update all stale components of a figure.

Notes

This is called automatically when each Axes is drawn. You may needto call it yourself if you need to update the Axes position and/orview limits before the Figure is drawn.

An alternative with a broader scope isFigure.draw_without_rendering,which updates all stale components of a figure, not only the positioning /view limits of a single Axes.

Examples

A typical usage example would be the following.imshow sets theaspect to 1, but adapting the Axes position and extent to reflect this isdeferred until rendering for performance reasons. If you want to know theAxes size before, you need to callapply_aspect to get the correctvalues.

>>>fig,ax=plt.subplots()>>>ax.imshow(np.zeros((3,3)))>>>ax.bbox.width,ax.bbox.height(496.0, 369.59999999999997)>>>ax.apply_aspect()>>>ax.bbox.width,ax.bbox.height(369.59999999999997, 369.59999999999997)