当前位置:网站首页>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 .
边栏推荐
- Analyse ArrayList 3: suppression d'éléments
- [linux]centos 7 reports an error when installing MySQL "no package MySQL server available" no package ZABBIX server MySQL available
- Vs2013 has blocked the installer, and ie10 needs to be installed
- Micro service component sentinel console call
- Web-ui automated testing - the most complete element positioning method
- PHP MySQL create database
- Ssl/bio of OpenSSL_ get_ fd
- Kotlin的協程:上下文
- [combinatorics] recursive equation (summary of the solution process of recursive equation | homogeneous | double root | non-homogeneous | characteristic root is 1 | exponential form | the bottom is th
- Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
猜你喜欢

win32:堆破壞的dump文件分析

基于人脸识别的课堂考勤系统 tkinter+openpyxl+face_recognition

Line by line explanation of yolox source code of anchor free series network (5) -- mosaic data enhancement and mathematical understanding

TCP拥塞控制详解 | 3. 设计空间

Codeforces Round #803 (Div. 2) C. 3SUM Closure

Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
![[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](/img/df/a034032e203e7935dafaf8a71cb6c8.jpg)
[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

Records of long objects and long judgments in the stream of list

Embedded-c language-7

win32:堆破坏的dump文件分析
随机推荐
Leetcode 538 converts binary search tree into cumulative tree -- recursive method and iterative method
Postfix tips and troubleshooting commands
Implementation of Tetris in C language
How to enforce parameters in PowerShell- How do I make parameters mandatory in PowerShell?
[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
微服务组件Sentinel控制台调用
Inheritance of ES6 class
ArrayList analysis 3: delete elements
PHP returns 500 errors but no error log - PHP return 500 error but no error log
[linux]centos 7 reports an error when installing MySQL "no package MySQL server available" no package ZABBIX server MySQL available
Talk about the design and implementation logic of payment process
Ssl/bio of OpenSSL_ get_ fd
Y is always discrete and can't understand, how to solve it? Answer: read it several times
Servlet specification Part II
MinGW compile boost library
Web-ui automated testing - the most complete element positioning method
Design limitations of structure type (struct)
PHP MySQL where clause
Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028
Kotlin's collaboration: Context