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]: vertical_axis not respected when rotating plots interactively #28040

Closed
Illviljan opened this issue Apr 7, 2024 · 0 comments · Fixed by #28039
Closed

[Bug]: vertical_axis not respected when rotating plots interactively #28040

Illviljan opened this issue Apr 7, 2024 · 0 comments · Fixed by #28039
Milestone

Comments

@Illviljan
Copy link
Contributor

Illviljan commented Apr 7, 2024

Bug summary

When setting ax.view_init(vertical_axis="x") the plot is initialized as intended but once rotating it a little the plot and ax._vertical_axis is reset to the default value.

Code for reproduction

x = np.array([0, 1, 2, 4])
y = np.array([5, 10])
z = np.array([100, 150, 200])
X, Y, Z = np.meshgrid(*[x, y, z], indexing="ij")
c = np.arange(0, X.size)

plt.figure()
for j, (a, e) in enumerate([(0, 0), (-60, 30)]):
    for i, vert_a in enumerate(["z", "y", "x"]):
        ax = plt.subplot(2, 3, j * 3 + 1 + i, projection="3d")
        pc = ax.scatter(X, Y, Z, c=c)
        # ax.view_init(vertical_axis=vert_a)
        # ax.view_init(azim=0, elev=0, vertical_axis=vert_a)
        # ax.view_init(azim=-60, elev=30, vertical_axis=vert_a)
        ax.view_init(azim=a, elev=e, vertical_axis=vert_a)
        ax.set_title(f"azim={a}, elev={e}, vertical_axis='{vert_a}'")
        ax.set_xlabel("x")
        ax.set_ylabel("y")
        ax.set_zlabel("z")

Actual outcome

Inital view:
image

After a small rotation on the bottom right plot:
image

Expected outcome

ax._vertical_axis should stay the same when rotating plots. This worked correctly in earlier matplotlib version.

Additional information

No response

Operating system

Windows 10

Matplotlib Version

3.8.3

Matplotlib Backend

Qt5Agg

Python version

3.12

Jupyter version

No response

Installation

conda

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

Successfully merging a pull request may close this issue.

3 participants