Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004
#Sucesión de funciones x^n (0<=x<=1) converge a 0 (0<=x<1) y 1 en x=1, conforme n crece! var('x n') f(x,n)=x^n sum([plot(f(x,n),0,1,hue=(n/100)) for n in [1..100,step=1]])
#Sucesión de reales 1/n converge a cero conforme n crece! sum([arrow((x,0), (x,1/x), hue=x/40) for x in [1..40,step=1]])
arrow2d?

File: /sagenb/sage_install/sage-4.8-sage.math.washington.edu-x86_64-Linux/local/lib/python2.6/site-packages/sage/misc/decorators.py

Type: <type ‘function’>

Definition: arrow2d(tailpoint=None, headpoint=None, path=None, head=1, linestyle=’solid’, rgbcolor=(0, 0, 1), width=2, zorder=2, legend_label=None, **options)

Docstring:

If tailpoint and headpoint are provided, returns an arrow from (xmin, ymin) to (xmax, ymax). If tailpoint or headpoint is None and path is not None, returns an arrow along the path. (See further info on paths in bezier_path).

INPUT:

  • tailpoint - the starting point of the arrow
  • headpoint - where the arrow is pointing to
  • path - the list of points and control points (see bezier_path for detail) that the arrow will follow from source to destination
  • head - 0, 1 or 2, whether to draw the head at the start (0), end (1) or both (2) of the path (using 0 will swap headpoint and tailpoint). This is ignored in 3D plotting.
  • width - (default: 2) the width of the arrow shaft, in points
  • color - (default: (0,0,1)) the color of the arrow (as an RGB tuple or a string)
  • hue - the color of the arrow (as a number)
  • arrowsize - the size of the arrowhead
  • arrowshorten - the length in points to shorten the arrow (ignored if using path parameter)
  • legend_label - the label for this item in the legend
  • zorder - the layer level to draw the arrow– note that this is ignored in 3D plotting.

EXAMPLES:

A straight, blue arrow:

sage: arrow2d((1, 1), (3, 3))

Make a red arrow:

sage: arrow2d((-1, -1), (2, 3), color=(1,0,0))
sage: arrow2d((-1, -1), (2, 3), color='red')

You can change the width of an arrow:

sage: arrow2d((1, 1), (3, 3), width=5, arrowsize=15)

A pretty circle of arrows:

sage: sum([arrow2d((0,0), (cos(x),sin(x)), hue=x/(2*pi)) for x in [0..2*pi,step=0.1]])

If we want to draw the arrow between objects, for example, the boundaries of two lines, we can use the arrowshorten option to make the arrow shorter by a certain number of points:

sage: line([(0,0),(1,0)],thickness=10)+line([(0,1),(1,1)], thickness=10)+arrow2d((0.5,0),(0.5,1), arrowshorten=10,rgbcolor=(1,0,0))

If BOTH headpoint and tailpoint are None, then an empty plot is returned:

sage: arrow2d(headpoint=None, tailpoint=None)

We can also draw an arrow with a legend:

sage: arrow((0,0), (0,2), legend_label='up')

Extra options will get passed on to show(), as long as they are valid:

sage: arrow2d((-2, 2), (7,1), frame=True)
sage: arrow2d((-2, 2), (7,1)).show(frame=True)