Bases: sage.plot.primitive.GraphicPrimitive
Primitive class for the Disk graphics type. See disk? for information about actually plotting a disk (the Sage term for a sector or wedge of a circle).
INPUT:
EXAMPLES:
Note this should normally be used indirectly via disk:
sage: from sage.plot.disk import Disk
sage: D = Disk((1,2), 2, (pi/2,pi), {'zorder':3})
sage: D
Disk defined by (1.0,2.0) with r=2.0 spanning (1.57079632679, 3.14159265359) radians
sage: D.options()['zorder']
3
sage: D.x
1.0
TESTS:
We test creating a disk:
sage: D = disk((2,3), 2, (0,pi/2))
Returns a dictionary with the bounding box data.
Plots a 2D disk (actually a 52-gon) in 3D, with default height zero.
INPUT:
AUTHORS:
EXAMPLES:
sage: disk((0,0), 1, (0, pi/2)).plot3d() sage: disk((0,0), 1, (0, pi/2)).plot3d(z=2) sage: disk((0,0), 1, (pi/2, 0), fill=False).plot3d(3)
These examples show that the appropriate options are passed:
sage: D = disk((2,3), 1, (pi/4,pi/3), hue=.8, alpha=.3, fill=True)
sage: d = D[0]
sage: d.plot3d(z=2).texture.opacity
0.300000000000000
A disk (that is, a sector or wedge of a circle) with center at a point = (or and parallel to the -plane) with radius = spanning (in radians) angle=`(rad1, rad2)`.
Type disk.options to see all options.
EXAMPLES:
Make some dangerous disks:
sage: bl = disk((0.0,0.0), 1, (pi, 3*pi/2), color='yellow')
sage: tr = disk((0.0,0.0), 1, (0, pi/2), color='yellow')
sage: tl = disk((0.0,0.0), 1, (pi/2, pi), color='black')
sage: br = disk((0.0,0.0), 1, (3*pi/2, 2*pi), color='black')
sage: P = tl+tr+bl+br
sage: P.show(aspect_ratio=1,xmin=-2,xmax=2,ymin=-2,ymax=2)
To correct the aspect ratio of certain graphics, it is necessary to show with a aspect_ratio of one:
sage: bl = disk((0.0,0.0), 1, (pi, 3*pi/2), color='yellow')
sage: bl.show(aspect_ratio=1)
You can also achieve the same aspect ratio by specifying a figsize with square dimensions:
sage: bl = disk((0.0,0.0), 1, (pi, 3*pi/2), rgbcolor=(1,1,0))
sage: bl.show(figsize=[5,5])
Note that since thickness defaults to zero, it is best to change that option when using fill=False:
sage: disk((2,3), 1, (pi/4,pi/3), hue=.8, alpha=.3, fill=False, thickness=2)
The previous two examples also illustrate using hue and rgbcolor as ways of specifying the color of the graphic.
We can also use this command to plot three-dimensional disks parallel to the -plane.
sage: d = disk((1,1,3), 1, (pi,3*pi/2), rgbcolor=(1,0,0)) sage: d sage: type(d) <type ‘sage.plot.plot3d.index_face_set.IndexFaceSet’>
Extra options will get passed on to show(), as long as they are valid:
sage: disk((0, 0), 5, (0, pi/2), xmin=0, xmax=5, ymin=0, ymax=5, figsize=(2,2), rgbcolor=(1, 0, 1))
sage: disk((0, 0), 5, (0, pi/2), rgbcolor=(1, 0, 1)).show(xmin=0, xmax=5, ymin=0, ymax=5, figsize=(2,2)) # These are equivalent
TESTS:
We cannot currently plot disks in more than three dimensions:
sage: d = disk((1,1,1,1), 1, (0,pi))
...
ValueError: The center point of a plotted disk should have two or three coordinates.