Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: The Axes3D does not work as expected. #24639

Closed
@jerryliu20d

Description

@jerryliu20d

Bug summary

The Axes3D does not work as expected.

Code for reproduction

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


plt.style.use('_mpl-gallery')

# Make data
np.random.seed(19680801)
n = 100
rng = np.random.default_rng()
xs = rng.uniform(23, 32, n)
ys = rng.uniform(0, 100, n)
zs = rng.uniform(-50, -25, n)

# Plot
# fig, ax = plt.subplots(subplot_kw={"projection": "3d"})
fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(xs, ys, zs)

ax.set(xticklabels=[],
       yticklabels=[],
       zticklabels=[])

plt.show()

Actual outcome

The outcome figure is blank.

Expected outcome

Should show figure with correct content.

Additional information

The code works well if changed to
fig, ax = plt.subplots(subplot_kw={"projection": "3d"})

Operating system

Windows

Matplotlib Version

3.6.2

Matplotlib Backend

Qt5Agg

Python version

3.9.15

Jupyter version

NA

Installation

conda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions