python代码螺旋线怎么写 |
您所在的位置:网站首页 › python画对数曲线 › python代码螺旋线怎么写 |
拿哪一个取决于你。从情节本身很难说,但我的猜测是它是线性的(最简单的选择)。在 使用您的代码并添加z轴,您可以这样做import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt from math import exp,sin,cos from pylab import * mpl.rcParams['legend.fontsize'] = 10 fig = plt.figure() ax = fig.gca(projection='3d') a=0.05 b=0.10 # took the liberty of reducing the max value for th # as it was giving you values of the order of e42 th=np.linspace(0, 50, 10000) x=a*exp(b*th)*cos(th) y=a*exp(b*th)*sin(th) z=np.linspace(0,2, 10000) # creating the z array with the same length as th ax.plot(x, y, z) # adding z as an argument for the plot ax.legend() plt.show() 您可以使用a和b参数来获得所需的椭圆形。您还可以使用z的定义,使其增长为指数或对数。。或者完全是别的什么。在 顺便说一句,您的导入有点多余,可能一个包中的某些函数被另一个包跟踪了。在 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |