Created
May 14, 2023 04:10
-
-
Save SnowyPainter/9f6dc345fa26af9cdbf0413774f6939e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
import numpy as np | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
# 첫 번째 구 | |
u, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j] | |
x = 1.5 * np.cos(u) * np.sin(v) | |
y = 1.5 * np.sin(u) * np.sin(v) | |
z = 1.5 * np.cos(v) | |
ax.plot_wireframe(x, y, z, color="b", alpha=0.2) | |
# 두 번째 구 | |
u, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j] | |
x = 1.5 * np.cos(u) * np.sin(v) + 7 | |
y = 1.5 * np.sin(u) * np.sin(v) | |
z = 1.5 * np.cos(v) | |
ax.plot_wireframe(x, y, z, color="b", alpha=0.2) | |
ax.set_xlim([-4, 11]) | |
ax.set_ylim([-4, 4]) | |
ax.set_zlim([-4, 4]) | |
ax.set_box_aspect([1.3, 0.8, 0.8]) | |
ax.text(0, 0, 0+1.5+0.5, "0 sec") | |
ax.text(7, 0, 0+1.5+0.5, "3 sec") | |
plt.legend() | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment