Skip to content

v. 3.3.0: horizontal colorbar broken #18033

@chris-hld

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions