File: streamribbon_demo2.py

package info (click to toggle)
scitools 0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 17,252 kB
  • ctags: 2,871
  • sloc: python: 28,744; sh: 112; makefile: 15
file content (40 lines) | stat: -rwxr-xr-x 1,022 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python

# Example taken from:
# http://www.mathworks.com/access/helpdesk/help/techdoc/ref/streamribbon.html

from scitools.easyviz import *
from time import sleep

xmin = -7; xmax = 7
ymin = -7; ymax = 7 
zmin = -7; zmax = 7 
x = linspace(xmin,xmax,30)
y = linspace(ymin,ymax,20)
z = linspace(zmin,zmax,20)
x,y,z = ndgrid(x,y,z,sparse=False)
u = y; v = -x; w = 0*x+1

setp(interactive=False)
hold('on')
daspect([1,1,1])
#cx,cy,cz = ndgrid(linspace(xmin,xmax,30),linspace(ymin,ymax,30),[-3,4])
#h2=coneplot(x,y,z,u,v,w,cx,cy,cz, 'q')
#set(h2, 'color', 'k');

# plot two sets of streamribbons:
sx,sy,sz = ndgrid([-1,0,1],[-1,0,1],[-6]*3,sparse=False)
p = streamribbon(x,y,z,u,v,w,sx,sy,sz)
sx,sy,sz = ndgrid(seq(1,6),zeros(6,float),[-6]*6,sparse=False)
p2 = streamribbon(x,y,z,u,v,w,sx,sy,sz)

# define viewing and lighting:
shading('interp')
view(-30,10); axis('off'); axis('tight')
camproj('perspective'); camva(66); camlookat()
camdolly(0,0,.5)
#camlight()

show()

raw_input('Press Return key to quit: ')