Arcs of circles and ellipses

class sage.plot.arc.Arc(x, y, r1, r2, angle, s1, s2, options)

Bases: sage.plot.primitive.GraphicPrimitive

Primitive class for the Arc graphics type. See arc? for information about actually plotting an arc of a circle or an ellipse.

INPUT:

  • x,y - coordinates of the center of the arc
  • r1, r2 - lengths of the two radii
  • angle - angle of the horizontal with width
  • sector - sector of angle
  • options - dict of valid plot options to pass to constructor

EXAMPLES:

Note that the construction should be done using arc:

sage: from sage.plot.arc import Arc
sage: print Arc(0,0,1,1,pi/4,pi/4,pi/2,{})
Arc with center (0.0,0.0) radii (1.0,1.0) angle 0.785398163397 inside the sector (0.785398163397,1.57079632679)
get_minmax_data()

Returns a dictionary with the bounding box data.

The bounding box is computed as minimal as possible.

EXAMPLES:

An example without angle:

sage: p = arc((-2, 3), 1, 2)
sage: d = p.get_minmax_data()
sage: d['xmin']
-3.0
sage: d['xmax']
-1.0
sage: d['ymin']
1.0
sage: d['ymax']
5.0

The same example with a rotation of angle \(\pi/2\):

sage: p = arc((-2, 3), 1, 2, pi/2)
sage: d = p.get_minmax_data()
sage: d['xmin']
-4.0
sage: d['xmax']
0.0
sage: d['ymin']
2.0
sage: d['ymax']
4.0
plot3d()

TESTS:

sage: from sage.plot.arc import Arc
sage: Arc(0,0,1,1,0,0,1,{}).plot3d()
Traceback (most recent call last):
...
NotImplementedError
sage.plot.arc.arc(center, r1, r2=None, angle=0.0, sector=(0.0, 6.283185307179586), rgbcolor='blue', thickness=1, zorder=5, aspect_ratio=1.0, alpha=1, linestyle='solid', **options)

An arc (that is a portion of a circle or an ellipse)

Type arc.options to see all options.

INPUT:

  • center - 2-tuple of real numbers - position of the center.
  • r1, r2 - positive real numbers - radii of the ellipse. If only r1 is set, then the two radii are supposed to be equal and this function returns an arc of of circle.
  • angle - real number - angle between the horizontal and the axis that corresponds to r1.
  • sector - 2-tuple (default: (0,2*pi))- angles sector in which the arc will be drawn.

OPTIONS:

  • alpha - float (default: 1) - transparency
  • thickness - float (default: 1) - thickness of the arc
  • color, rgbcolor - string or 2-tuple (default: ‘blue’) - the color of the arc
  • linestyle - string (default: 'solid') - The style of the line, which is one of 'dashed', 'dotted', 'solid', 'dashdot', or '--', ':', '-', '-.', respectively.

EXAMPLES:

Plot an arc of circle centered at (0,0) with radius 1 in the sector \((\pi/4,3*\pi/4)\):

sage: arc((0,0), 1, sector=(pi/4,3*pi/4))

Plot an arc of an ellipse between the angles 0 and \(\pi/2\):

sage: arc((2,3), 2, 1, sector=(0,pi/2))

Plot an arc of a rotated ellipse between the angles 0 and \(\pi/2\):

sage: arc((2,3), 2, 1, angle=pi/5, sector=(0,pi/2))

Plot an arc of an ellipse in red with a dashed linestyle:

sage: arc((0,0), 2, 1, 0, (0,pi/2), linestyle="dashed", color="red")
sage: arc((0,0), 2, 1, 0, (0,pi/2), linestyle="--", color="red")

The default aspect ratio for arcs is 1.0:

sage: arc((0,0), 1, sector=(pi/4,3*pi/4)).aspect_ratio()
1.0

It is not possible to draw arcs in 3D:

sage: A = arc((0,0,0), 1)
Traceback (most recent call last):
...
NotImplementedError

Previous topic

Animated plots

Next topic

Arrows

This Page