capwitf/My-MathModeling-skills / math-figure
math-figure
UnverifiedUse when 高教社杯/CUMCM 数学建模论文需要规划、选择、审查或修复图、图表、表格转图、图注、图像证据行、正文放置、附录降级或图后结论。
assets/high-impact-templates/figures4papers/figure_RNAGenScape/plot_manifold.py
View on GitHubimport os
import numpy as np
import matplotlib.pyplot as plt
def function(x, y):
z = 0.6 * np.exp(-((x - 1)**2 + (y + 1)**2))
z += 0.5 * np.exp(-((x - 1)**2 + (y - 4)**2))
z += 0.3 * np.exp(-((x - 2)**2 + (y - 2)**2))
z += 0.2 * np.exp(-((x + 3)**2 + (y + 1)**2))
z += 0.3 * np.exp(-((x + 1)**2 + (y + 1)**2))
z -= 0.1 * np.exp(-((x + 1)**2 + (y - 2)**2))
z += 0.3 * np.exp(-((x + 2)**2 + (y - 2)**2))
z += 0.3 * np.exp(-((x + 2)**2 + (y - 1)**2))
return z
if __name__ == '__main__':
# Generate coordinates
x = np.linspace(-3, 3, 200)
y = np.linspace(-3, 3, 200)
x, y = np.meshgrid(x, y)
# Define a multi-well "energy" function (inverted to form valleys)
z = function(x, y)
# Set up plot
fig = plt.figure(figsize=(10, 7))
ax = fig.add_subplot(1, 1, 1, projection='3d')
# Plot the surface with smooth shading
ax.plot_surface(
x, y, z,
cmap='coolwarm',
edgecolor='none',
linewidth=0,
antialiased=True,
alpha=0.95,
)
# # Plot descent path
# path_x = np.linspace(-2.5, 1, 100)
# path_y = np.linspace(2.5, -1, 100)
# path_z = function(path_x, path_y)
# ax.plot(path_x, path_y, path_z, color='red', linestyle='--', linewidth=3)
# Aesthetics
ax.set_xticks([])
ax.set_yticks([])
ax.set_zticks([])
ax.xaxis.pane.set_visible(False)
ax.yaxis.pane.set_visible(False)
ax.zaxis.pane.set_visible(False)
ax.xaxis.line.set_color((0.0, 0.0, 0.0, 0.0))
ax.yaxis.line.set_color((0.0, 0.0, 0.0, 0.0))
ax.zaxis.line.set_color((0.0, 0.0, 0.0, 0.0))
ax.set_box_aspect([1, 1, 0.5])
ax.view_init(elev=20, azim=50)
fig.tight_layout(pad=2)
os.makedirs('./figures', exist_ok=True)
fig.savefig('./figures/manifold.png')
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |