Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Data clip box not aligned with axis planes when 3d plot box aspect is enlargened #23450

Open
scottshambaugh opened this issue Jul 19, 2022 · 1 comment

Comments

@scottshambaugh
Copy link
Contributor

scottshambaugh commented Jul 19, 2022

Bug summary

When enlarging 3D plots with ax.set_box_aspect(None, zoom=zoom), there is a mismatch between the limits of rendering data and the axis planes. These should be aligned.

Code for reproduction

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
from itertools import product, combinations

fig, ax = plt.subplots(1, 1, subplot_kw={'projection': '3d'})

r = [0, 1]
scale = np.array([1, 1, 2])
# Draw rectangular cuboid with side lengths [1, 1, 2]
for start, end in combinations(np.array(list(product(r, r, r))), 2):
    if np.sum(np.abs(start - end)) == r[1] - r[0]:
        ax.plot3D(*zip(start*scale, end*scale))

ax.view_init(elev=7, azim=35, roll=45)
ax.set_box_aspect(None, zoom=1.25)
ax.set_proj_type('ortho')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')

Actual outcome

image

Expected outcome

I would expect either the corners of the plotted box to be included, or the corners of the axis planes to be cut off. Ideally the first one.

Additional information

No response

Operating system

No response

Matplotlib Version

3.6.0.dev2960+g51ce6776b1

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

No response

@scottshambaugh scottshambaugh changed the title [Bug]: Data clip box not aligned with axis planes when [Bug]: Data clip box not aligned with axis planes when 3d plot box aspect is enlargened Jul 19, 2022
@scottshambaugh
Copy link
Contributor Author

scottshambaugh commented Jul 19, 2022

Somewhat related to #19519

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants