Fixat så att graferna ritas tillsammans i en gemensam ram

This commit is contained in:
2024-07-14 21:07:53 +02:00
parent 5999fbf1cc
commit 5c669265fa
+1 -6
View File
@@ -9,14 +9,12 @@ def plot_surface(ax):
X, Y = np.meshgrid(x, y)
Z = (np.sin(X**2 + Y**2)) / (X**2 + Y**2)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z, cmap='viridis', edgecolor='none')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
ax.set_title(r'$Z = \frac{\sin(X^2 + Y^2)}{X^2 + Y^2}$')
plt.show()
# Function to plot the Klein bottle using parametric equations
def plot_klein_bottle(ax):
@@ -28,8 +26,6 @@ def plot_klein_bottle(ax):
y = np.cos(V) * (np.cos(T) + 2)
z = np.sin(T) * np.cos(V)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
# Plot the surface with color and smoothing parameters
ax.plot_surface(x, y, z, color='b', rstride=4, cstride=4) # Adjust rstride and cstride for smoother or more detailed surface
@@ -38,7 +34,6 @@ def plot_klein_bottle(ax):
ax.set_zlim([-1, 1])
ax.set_title('Klein Bottle')
plt.show()
# Main function to call the plotting functions
def main():