当前位置:网站首页>Valentine's day, send you a little red flower~
Valentine's day, send you a little red flower~
2022-07-03 17:57:00 【Xia Xiaoyou】
List of articles
Preface
stay github See an interesting code on , It's Valentine's Day , Share with you ^_^
1. in early puberty
3D The drawing of the model requires grid points , About the role of grid points , stay This blog Has been introduced in , No more details here .
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
# Moved the phase back 6*pi
x = np.linspace(0, 1, num=30)
t = np.linspace(0, 1, num=1200) * 20 * np.pi + 4 * np.pi
x, t = np.meshgrid(x, t)
p = 0.5 * np.pi * np.exp(-t / (8 * np.pi))
# Add edge perturbation
change = np.sin(15 * t) / 150
# take t The number of parameters is reduced , Increase the angle of the petals
u = 1 - (1 - np.mod(3.3 * t, 2 * np.pi) / np.pi)**4 / 2 + change
y = 2 * (x**2 - x)**2 * np.sin(p)
r = u * (x * np.sin(p) + y * np.cos(p)) * 1.5
h = u * (x * np.cos(p) - y * np.sin(p))
# PiYG_r
# RdBu_r
surf = ax.plot_surface(r * np.cos(t), r * np.sin(t), h,
rstride=1, cstride=1, cmap=plt.cm.RdPu_r)
plt.savefig('img/img1.png')
plt.show()



2. Beating its China
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = Axes3D(fig)
# plt.axis('off')
x = np.linspace(0, 1, num=30)
t = np.linspace(0, 1, num=1200) * 50 * np.pi - 4 * np.pi
x, t = np.meshgrid(x, t)
p = 0.5 * np.pi * np.exp(-t / (8 * np.pi))
change = np.sin(20 * t) / 50
u = 1 - (1 - np.mod(3.3 * t, 2 * np.pi) / np.pi)**4 / 2 + change
y = 2 * (x**2 - x)**2 * np.sin(p)
r = u * (x * np.sin(p) + y * np.cos(p)) * 1.5
h = u * (x * np.cos(p) - y * np.sin(p))
ax = ax.plot_surface(r * np.cos(t), r * np.sin(t), h,
rstride=1, cstride=1, cmap=plt.cm.RdPu_r)
plt.savefig('img/img2.png')
plt.show()



of
mpl_toolkits.mplot3dYou can refer to Official documents ;
For more color combinations, please refer to
matplotlibOfcolormapThe official manual .
边栏推荐
- Keepalived 设置不抢占资源
- Introduction to SolidWorks gear design software tool geartrax
- Keepalived setting does not preempt resources
- Type conversion, variable
- How to enforce parameters in PowerShell- How do I make parameters mandatory in PowerShell?
- Introduction to PHP MySQL
- Detailed explanation of common network attacks
- Win32: analyse du fichier dump pour la défaillance du tas
- STM32实现74HC595控制
- List的stream中Long对象与long判等问题记录
猜你喜欢

Tensorboard quick start (pytoch uses tensorboard)

PHP MySQL preprocessing statement

Redis core technology and practice - learning notes (11): why not just string

Implementation of Tetris in C language

Research Report on market demand and investment planning for the development of China's office chair industry, 2022-2028

面试官:值为 nil 为什么不等于 nil ?

聊聊支付流程的设计与实现逻辑

Micro service component sentinel console call

STM32 realizes 74HC595 control
![Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]](/img/da/0a282b4773fe3909d1e5e9d19f8549.jpg)
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]
随机推荐
Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028
Tensorboard quick start (pytoch uses tensorboard)
The difference between i++ and ++i: tell their differences easily
Inheritance of ES6 class
Redis core technology and practice - learning notes (VIII) sentinel cluster: sentinel hung up
PUT vs. POST for Uploading Files - RESTful API to be Built Using Zend Framework
聊聊支付流程的设计与实现逻辑
Five problems of database operation in commodity supermarket system
PHP MySQL reads data
ArrayList分析3 : 删除元素
Codeforces Round #803 (Div. 2) C. 3SUM Closure
MySQL has been stopped in the configuration interface during installation
ES6类的继承
[Yu Yue education] family education SPOC class 2 reference materials of Shanghai Normal University
How to purchase Google colab members in China
[set theory] order relation: summary (partial order relation | partial order set | comparable | strictly less than | covering | hasto | total order relation | quasi order relation | partial order rela
Global and Chinese health care OEM and ODM market status survey and investment planning recommendations report 2022-2028
Introduction to PHP MySQL
Draw some simple graphics with MFC
网格图中递增路径的数目[dfs逆向路径+记忆dfs]