Rotating animation of 3D plot changes size as it rotates (GLMakie)

This is controlled by the viewmode setting, you need :fit Axis3 | Makie

I emphasized the problem you mention in the docs snippet below

viewmode

Defaults to :fitzoom

The view mode affects the final projection of the axis by fitting the axis cuboid into the available space in different ways.

  • :fit uses a fixed scaling such that a tight sphere around the cuboid touches the frame edge. This means that the scaling doesn’t change when rotating the axis (the apparent size of the axis stays the same), but not all available space is used. The chosen aspect is maintained using this setting.
  • :fitzoom uses a variable scaling such that the closest cuboid corner touches the frame edge. When rotating the axis, the apparent size of the axis changes which can result in a “pumping” visual effect. The chosen aspect is also maintained using this setting.
  • :stretch pulls the cuboid corners to the frame edges such that the available space is filled completely. The chosen aspect is not maintained using this setting, so :stretch should not be used if a particular aspect is needed.
  • :free behaves like :fit but changes some interactions. Zooming affects the whole axis rather than just the content. This allows you to zoom in on content without it getting clipped by the 3D bounding box of the Axis3. zoommode = :cursor is disabled. Translations can no also affect the axis as a whole with control + right drag.

Also, you should not use the cam_ functions with Axis3, it’s not a plain Scene and controls its camera through different attributes. elevation and azimuth control the two camera rotations

5 Likes