3D Trisurf
Fractal Basin Trisurf
Newton fractal iteration count landscape in purple-magenta gradient.
Output
Python
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import LinearSegmentedColormap
# Scattered sampling
np.random.seed(33)
n_points = 600
x = np.random.uniform(-2, 2, n_points)
y = np.random.uniform(-2, 2, n_points)
# Newton fractal for z^3 - 1 (iteration count)
c = x + 1j*y
for _ in range(20):
c = c - (c**3 - 1) / (3*c**2 + 1e-10)
z = np.angle(c)
# Custom colormap
colors = ['#0a0a0f', '#3b0764', '#4927F5', '#F527B0', '#f9a8d4']
cmap = LinearSegmentedColormap.from_list('purple_magenta', colors, N=256)
fig = plt.figure(figsize=(10, 8), facecolor='#0a0a0f')
ax = fig.add_subplot(111, projection='3d', facecolor='#0a0a0f')
surf = ax.plot_trisurf(x, y, z, cmap=cmap, alpha=0.9, linewidth=0.1, edgecolor='#ffffff08')
ax.set_xlabel('Re', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_ylabel('Im', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_zlabel('Phase', fontsize=10, color='#94a3b8', labelpad=10)
ax.set_title("Fractal Basin Trisurf", fontsize=14, color='white', fontweight='bold', pad=20)
ax.tick_params(colors='#64748b', labelsize=8)
ax.xaxis.pane.fill = False
ax.yaxis.pane.fill = False
ax.zaxis.pane.fill = False
ax.xaxis.pane.set_edgecolor('#1e293b')
ax.yaxis.pane.set_edgecolor('#1e293b')
ax.zaxis.pane.set_edgecolor('#1e293b')
ax.view_init(elev=35, azim=45)
plt.tight_layout()
plt.show()
Library
Matplotlib
Category
3D Charts
More 3D Trisurf examples
☕