本文实例讲述了Python实现的绘制三维双螺旋线图形功能。分享给大家供大家参考,具体如下:
代码:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# -*- coding:utf-8 -*-
#! python3
#绘制三维双螺旋线
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.mplot3d
t = list ( range ( 100 , 200 ))
r = [i * np.cos( 60 + i * 360 * 5 ) for i in t]
theta = [i * np.sin( 60 + i * 360 * 5 ) for i in t]
z = [ 50 * i for i in t]
ax = plt.figure().add_subplot( 111 ,projection = '3d' )
ax.scatter(r,theta,z,c = 'rbrb' * 25 )
plt.show()
|
其中t里可以修改绘制点的个数
运行效果如下:
希望本文所述对大家Python程序设计有所帮助。
原文链接:https://blog.csdn.net/weixin_40198632/article/details/78896614