Ask Your Question
1

Add little arrow tips at the end of the coordinate axes

asked 2011-11-19 14:56:22 +0100

sagefan gravatar image

Is it possible to add little arrow tips to the end of the coordinate axes?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-11-21 10:41:11 +0100

Mike Witt gravatar image

Could you do something like this?

----------------------------------------------------------------------
| Sage Version 4.7.2, Release Date: 2011-10-29                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: def myAxes(size=1,type='arrow',width=0,color='black'):
....:         if type=='line':
....:             if width==0: width=1
....:         xAxis = line3d([(0,0,0),(size,0,0)],width=width,color=color)
....:         yAxis = line3d([(0,0,0),(0,size,0)],width=width,color=color)
....:         zAxis = line3d([(0,0,0),(0,0,size)],width=width,color=color)
....:     if type=='arrow':
....:             if width==0: width=.5
....:         xAxis = arrow3d((0,0,0),(size,0,0),width=width,color=color)
....:         yAxis = arrow3d((0,0,0),(0,size,0),width=width,color=color)
....:         zAxis = arrow3d((0,0,0),(0,0,size),width=width,color=color)
....:     xAxis += text3d("x", (size*1.1,0,0))
....:     yAxis += text3d("y", (0,size*1.1,0))
....:     zAxis += text3d("z", (0,0,size*1.1))
....:     return(xAxis+yAxis+zAxis)
....: 
sage: myAxes(color='blue').show()
sage:
edit flag offensive delete link more

Comments

Or the analogue for 2d axes, of course.

Jason Grout gravatar imageJason Grout ( 2011-11-21 23:30:44 +0100 )edit

Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1013, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "<string>", line 1 | Sage Version RealNumber('4.7').gen(2), Release Date: Integer(2011)-Integer(10)-Integer(29) | ^ SyntaxError: invalid syntax

MKS gravatar imageMKS ( 2018-02-10 04:50:04 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-11-19 14:56:22 +0100

Seen: 380 times

Last updated: Nov 21 '11