- 积分
- 55955
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2011-6-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
streamplot3函数可以追踪并绘制三维流线,也可以自定义流线追踪的起始点。
- # Make the grid
- x, y, z = meshgrid(arange(-1.5, 1.5, 0.1),
- arange(-1.5, 1.5, 0.1),
- arange(-1.5, 1.5, 0.1))
- # Make the direction data for the arrows
- u = x + cos(4*x) + 3 # x-component of vector field
- v = sin(4*x) - sin(2*y) # y-component of vector field
- w = -z # z-component of vector field
- speed = sqrt(u*u + v*v + w*w)
- sx, sy, sz = meshgrid([-1.5], [-1,0,1], [-1,0,1])
- qq = streamplot3(x, y, z, u, v, w, speed, linewidth=2,
- density=4, interval=10, start_x=sx, start_y=sy, start_z=sz)
- scatter3(sx, sy, sz, c='k')
- colorbar(qq)
- xlim(-1.5, 1.5)
- ylim(-1.5, 1.5)
- zlim(-1.5, 1.5)
- antialias(True)
streamslice函数可以在三维数据的某个轴切片上绘制流线图。
- # Make the grid
- x, y, z = meshgrid(arange(-1.5, 1.6, 0.1),
- arange(-1.5, 1.6, 0.1),
- arange(-1.5, 1.6, 0.1))
- # Make the direction data for the arrows
- u = x + cos(4*x) + 3 # x-component of vector field
- v = sin(4*x) - sin(2*y) # y-component of vector field
- w = -z # z-component of vector field
- speed = sqrt(u*u + v*v + w*w)
- streamslice(x, y, z, u, v, w, xslice=1.5, yslice=1.5, zslice=-1.5,
- color='b', linewidth=1, density=4, interval=5)
- xlim(-1.5, 1.5)
- ylim(-1.5, 1.5)
- zlim(-1.5, 1.5)
- plt.antialias(True)
|
|