Skip to content

3d axes are collapsed by tight_layout #12239

@adeak

Description

@adeak

Calling fig.tight_layout() on a figure with a 3d Axes inside will collapse the axes into a vertical line.

Minimal example:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

for tighten in False,True:
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    ax.plot([1,2], [1,2], [1,2])
    if tighten:
        fig.tight_layout()

plt.show()

The following figures are produced with python 3.7, matplotlib 3.0.0 (also master):
figure without tight_layout: all's fine
figure with tight_layout: axes is a single vertical line

There's also a warning that says
/home/user/matplotlib-env/lib/python3.7/site-packages/matplotlib/tight_layout.py:177: UserWarning: The left and right margins cannot be made large enough to accommodate all axes decorations.
but that's hardly surprising since there's no room for any decorations whatsoever.

May or may not be related to the recent-ish issues fixed by #11739 and #11627.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy