-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatplotlib.py
More file actions
44 lines (33 loc) · 1.31 KB
/
matplotlib.py
File metadata and controls
44 lines (33 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
""" anyplot.ai
surface-basic: Basic 3D Surface Plot
Library: matplotlib 3.10.9 | Python 3.13.13
Quality: 81/100 | Updated: 2026-05-05
"""
import matplotlib.pyplot as plt
import numpy as np
# Data - create a 40x40 grid for smooth visualization
x = np.linspace(-4, 4, 40)
y = np.linspace(-4, 4, 40)
X, Y = np.meshgrid(x, y)
# Gaussian-like surface with interesting features (radial ripple pattern)
Z = np.sin(np.sqrt(X**2 + Y**2)) * np.exp(-0.1 * (X**2 + Y**2))
# Create 3D plot (4800x2700 px)
fig = plt.figure(figsize=(16, 9))
ax = fig.add_subplot(111, projection="3d")
# Plot surface with colormap
surf = ax.plot_surface(X, Y, Z, cmap="viridis", edgecolor="none", alpha=0.9, antialiased=True)
# Add colorbar
cbar = fig.colorbar(surf, ax=ax, shrink=0.5, aspect=10, pad=0.1)
cbar.set_label("Z Value", fontsize=16)
cbar.ax.tick_params(labelsize=12)
# Labels and styling (scaled font sizes for 4800x2700)
ax.set_xlabel("X Axis", fontsize=18, labelpad=12)
ax.set_ylabel("Y Axis", fontsize=18, labelpad=12)
ax.set_zlabel("Z Axis", fontsize=18, labelpad=12)
ax.set_title("surface-basic · matplotlib · pyplots.ai", fontsize=24, pad=20)
# Tick parameters
ax.tick_params(axis="both", labelsize=14)
# Set viewing angle for good perspective
ax.view_init(elev=30, azim=45)
plt.tight_layout()
plt.savefig("plot.png", dpi=300, bbox_inches="tight")