@@ -1533,14 +1533,15 @@ def get_radius(self):
1533
1533
1534
1534
class Arc (Ellipse ):
1535
1535
"""
1536
- An elliptical arc. Because it performs various optimizations, it
1537
- can not be filled.
1538
-
1539
- The arc must be used in an :class:`~matplotlib.axes.Axes`
1540
- instance---it can not be added directly to a
1541
- :class:`~matplotlib.figure.Figure`---because it is optimized to
1542
- only render the segments that are inside the axes bounding box
1543
- with high resolution.
1536
+ An elliptical arc, i.e. a segment of an ellipse.
1537
+
1538
+ Due to internal optimizations, there are certain restrictions on using Arc:
1539
+
1540
+ - The arc cannot be filled.
1541
+
1542
+ - The arc must be used in an :class:`~.axes.Axes` instance---it can not be
1543
+ added directly to a `.Figure`---because it is optimized to only render
1544
+ the segments that are inside the axes bounding box with high resolution.
1544
1545
"""
1545
1546
def __str__ (self ):
1546
1547
pars = (self .center [0 ], self .center [1 ], self .width ,
@@ -1553,32 +1554,35 @@ def __str__(self):
1553
1554
def __init__ (self , xy , width , height , angle = 0.0 ,
1554
1555
theta1 = 0.0 , theta2 = 360.0 , ** kwargs ):
1555
1556
"""
1556
- The following args are supported:
1557
-
1558
- *xy*
1559
- center of ellipse
1560
-
1561
- *width*
1562
- length of horizontal axis
1563
-
1564
- *height*
1565
- length of vertical axis
1557
+ Parameters
1558
+ ----------
1559
+ xy : (float, float)
1560
+ The center of the ellipse.
1566
1561
1567
- *angle*
1568
- rotation in degrees (anti-clockwise)
1562
+ width : float
1563
+ The length of the horizontal axis.
1569
1564
1570
- *theta1*
1571
- starting angle of the arc in degrees
1565
+ height : float
1566
+ The length of the vertical axis.
1572
1567
1573
- *theta2*
1574
- ending angle of the arc in degrees
1568
+ angle : float
1569
+ Rotation of the ellipse in degrees (anti-clockwise).
1575
1570
1576
- If *theta1* and *theta2* are not provided, the arc will form a
1577
- complete ellipse.
1571
+ theta1, theta2 : float, optional
1572
+ Starting and ending angles of the arc in degrees. These values
1573
+ are relative to *angle*, .e.g. if *angle* = 45 and *theta1* = 90
1574
+ the absolute starting angle is 135.
1575
+ Default *theta1* = 0, *theta2* = 360, i.e. a complete ellipse.
1578
1576
1579
- Valid kwargs are:
1577
+ Other Parameters
1578
+ ----------------
1579
+ **kwargs : `.Patch` properties
1580
+ Most `.Patch` properties are supported as keyword arguments,
1581
+ with the exception of *fill* and *facecolor* because filling is
1582
+ not supported.
1580
1583
1581
1584
%(Patch)s
1585
+
1582
1586
"""
1583
1587
fill = kwargs .setdefault ('fill' , False )
1584
1588
if fill :
@@ -1592,12 +1596,16 @@ def __init__(self, xy, width, height, angle=0.0,
1592
1596
@artist .allow_rasterization
1593
1597
def draw (self , renderer ):
1594
1598
"""
1599
+ Draw the arc to the given *renderer*.
1600
+
1601
+ Notes
1602
+ -----
1595
1603
Ellipses are normally drawn using an approximation that uses
1596
1604
eight cubic Bezier splines. The error of this approximation
1597
1605
is 1.89818e-6, according to this unverified source:
1598
1606
1599
- Lancaster, Don. Approximating a Circle or an Ellipse Using
1600
- Four Bezier Cubic Splines.
1607
+ Lancaster, Don. * Approximating a Circle or an Ellipse Using
1608
+ Four Bezier Cubic Splines.*
1601
1609
1602
1610
http://www.tinaja.com/glib/ellipse4.pdf
1603
1611
@@ -1613,27 +1621,27 @@ def draw(self, renderer):
1613
1621
with each visible arc using a fixed number of spline segments
1614
1622
(8). The algorithm proceeds as follows:
1615
1623
1616
- 1. The points where the ellipse intersects the axes bounding
1617
- box are located. (This is done be performing an inverse
1618
- transformation on the axes bbox such that it is relative
1619
- to the unit circle -- this makes the intersection
1620
- calculation much easier than doing rotated ellipse
1621
- intersection directly).
1624
+ 1. The points where the ellipse intersects the axes bounding
1625
+ box are located. (This is done be performing an inverse
1626
+ transformation on the axes bbox such that it is relative
1627
+ to the unit circle -- this makes the intersection
1628
+ calculation much easier than doing rotated ellipse
1629
+ intersection directly).
1622
1630
1623
- This uses the "line intersecting a circle" algorithm
1624
- from:
1631
+ This uses the "line intersecting a circle" algorithm
1632
+ from:
1625
1633
1626
- Vince, John. Geometry for Computer Graphics: Formulae,
1627
- Examples & Proofs. London: Springer-Verlag, 2005.
1634
+ Vince, John. * Geometry for Computer Graphics: Formulae,
1635
+ Examples & Proofs.* London: Springer-Verlag, 2005.
1628
1636
1629
- 2. The angles of each of the intersection points are
1630
- calculated.
1637
+ 2. The angles of each of the intersection points are
1638
+ calculated.
1631
1639
1632
- 3. Proceeding counterclockwise starting in the positive
1633
- x-direction, each of the visible arc-segments between the
1634
- pairs of vertices are drawn using the Bezier arc
1635
- approximation technique implemented in
1636
- :meth:`matplotlib.path.Path.arc`.
1640
+ 3. Proceeding counterclockwise starting in the positive
1641
+ x-direction, each of the visible arc-segments between the
1642
+ pairs of vertices are drawn using the Bezier arc
1643
+ approximation technique implemented in
1644
+ :meth:`matplotlib.path.Path.arc`.
1637
1645
"""
1638
1646
if not hasattr (self , 'axes' ):
1639
1647
raise RuntimeError ('Arcs can only be used in Axes instances' )
0 commit comments