I need to display a point cloud and i'm using matplotlib figure with Axes3D and scatter.
This is the toy code:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
xs = np.arange(10)
ys = np.arange(10)
zs = np.arange(10)
fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(xs, ys, zs, color='green')
# setting title and labels
ax.set_title("3D plot")
ax.set_xlabel('x-axis')
ax.set_ylabel('y-axis')
ax.set_zlabel('z-axis')
ax.autoscale()
# displaying the plot
#plt.savefig("test")
plt.show()
#fig.savefig("test.png")
this same code produces an empty image if run by terminal and this (as expected) if run in a jupyter cell expexted result, obtained in jupyter
edit: I tried running the solution posted by Wayne and got this: https://i.stack.imgur.com/8jPM4.png It opened in a plot window when running the program from the VSCode terminal