from __future__ import division, print_function from visual import * # right button mouse drag spins (Mac: option key + mouse) # double button mouse drag zooms (Mac: command key + mouse) # Setup: constants d = 25 # adjust length of axes as needed r = d*.008 # thickness of axes # Setup: scene parameters scene.background = color.white # this makes it easier to see when projected scene.x = scene.y = 0 scene.width = scene.height = 800 scene.forward = vector(0, 0.8, -0.5) # look toward points we'll add scene.range = 1.2*d # zoom to appropriate level # Setup: coordinate axes w/labels xaxis = cylinder(pos=vector(0,0,0),axis=vector(d,0,0),radius=r,color=color.red) yaxis = cylinder(pos=vector(0,0,0),axis=vector(0,d,0),radius=r,color=color.green) zaxis = cylinder(pos=vector(0,0,0),axis=vector(0,0,d),radius=r,color=color.blue) label(pos=xaxis.pos+xaxis.axis,text='x',box=0) label(pos=yaxis.pos+yaxis.axis,text='y',box=0) label(pos=zaxis.pos+zaxis.axis,text='z',box=0)