Skip to content

v. 3.3.0: horizontal colorbar broken #18033

Description

@chris-hld

Bug report

Bug summary

Horizontal colorbar location changed to something broken in latest 3.3.0

Code for reproduction

Here is a minimal example in the exact way I am using it. Is there any quick fix/workaround? I really appreciate the improved 3D axis handling in v. 3.3!

import numpy as np
import matplotlib.pyplot as plt

import matplotlib as mpl
ver = mpl.__version__

num_plots = 4
fig = plt.figure(figsize=plt.figaspect(1 / num_plots),
                 constrained_layout=True)

ax_l = []

for idx in range(num_plots):
    ax = fig.add_subplot(1, num_plots, idx+1, projection='3d')
    p_tri = ax.plot_trisurf(np.random.randn(5), np.random.randn(5), np.random.randn(5),
                            cmap=plt.cm.coolwarm)
    ax_l.append(ax)

cbar = plt.colorbar(p_tri, ax=ax_l, orientation='horizontal')


plt.suptitle(ver)

plt.savefig(str(ver)+'.jpg')
plt.show()

Actual outcome

from v. 3.2.0
3 2 0

from v. 3.3.0
3 3 0

Activity

  1. added this to the v3.3.1 milestone on Jul 23, 2020
  2. chris-hld commented on Jul 23, 2020

    @chris-hld
    Author

    Possibly related to constrained_layout.

    Output with constrained_layout=False
    3 3 0

  3. jklymak commented on Jul 23, 2020

    @jklymak
    Member

    This is not a bug with regular axes, so its some sort of mplot3d issue.

    Its possible constrained_layout works w/ mplot3d sometimes, but its not tested with mplot3d. But I can't bisect the error sensibly, partially because the toolkits don't install in conda/pip the same way as the core library. So hopefully someone w/ a working mplot3d debug setup can at least bisect so we can see what change caused this.

  4. jklymak commented on Jul 23, 2020

    @jklymak
    Member

    Note this would be closed by #17494

  5. linked a pull request that will close this issueRewrite of constrained_layout.... #17494on Jul 23, 2020
  6. tacaswell commented on Jul 23, 2020

    @tacaswell
    Member

    To check, the problematic change is the colorbar floating to the top?

    Assuming we don't want to backport the CL re-write for 3.3.x is there another workaround other than turning CL off ?

  7. jklymak commented on Jul 23, 2020

    @jklymak
    Member

    I don't know. I can't bisect mplot3d stuff to figure out what is going on.

  8. jklymak commented on Jul 23, 2020

    @jklymak
    Member

    This bisects to 4479a0f #16472

  9. jklymak commented on Jul 23, 2020

    @jklymak
    Member

    ok fixed #18038 as far as I can tell.

  10. jklymak commented on Jul 23, 2020

    @jklymak
    Member

    @chris-hld unfortunately I cannot think of a good workaround short of installing the 3.3.1 branch or downgrading to 3.2 until 3.3.1 is released.

  11. chris-hld commented on Jul 24, 2020

    @chris-hld
    Author

    Thank you very much!
    I just disable constrained_layout for this particular one now and will revisit with 3.3.1!

  12. added a commit that references this issue on Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions