1

Here is an example of matplotlib displaying a black window on my local environment.

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

fig = plt.figure()
ax = Axes3D(fig, elev=4, azim=-95)
xs, ys, zs = np.linspace(-2, 2, 60), np.linspace(-2, 2, 60), np.linspace(-2, 2, 60)
ax.scatter(xs=xs, ys=xs, zs=xs)
plt.show()

I know the issue is not my backend as others have reported, since I can run the snippet at this site fine:

https://matplotlib.org/2.0.2/examples/mplot3d/subplot3d_demo.html

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
IntegrateThis
  • 853
  • 2
  • 16
  • 39

1 Answers1

1
  • ax = fig.add_subplot(projection='3d', elev=4, azim=-95) not ax = Axes3D(fig, elev=4, azim=-95), just like it shows in the example.
  • Tested in python 3.11.3, matplotlib 3.7.1
import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.add_subplot(projection='3d', elev=4, azim=-95)

xs, ys, zs = np.linspace(-2, 2, 60), np.linspace(-2, 2, 60), np.linspace(-2, 2, 60)
ax.scatter(xs=xs, ys=xs, zs=xs)
plt.show()

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158