# plotm3d1.py3 sphere from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np print("plotm3d1.py3 using matplotlin") fig = plt.figure() ax = fig.add_subplot(111, projection='3d') # Make data R = 10.0 u = np.linspace(0, 2.0*np.pi, 20) # theta v = np.linspace(0, np.pi, 20) # phi print("u=", u) print("v=", v) x = R * np.outer(np.cos(u), np.sin(v)) y = R * np.outer(np.sin(u), np.sin(v)) z = R * np.outer(np.ones(np.size(u)), np.cos(v)) print("original") print("x=", x) print("y=", y) print("z=", z) # Plot the surface ax.plot_surface(x, y, z, color='r') ax.set_title('plotm3d1.py3 sphere') ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z') plt.show() print("plotm3d1.py3 finished")