@@ -1907,14 +1907,9 @@ class Arc(Ellipse):
1907
1907
"""
1908
1908
An elliptical arc, i.e. a segment of an ellipse.
1909
1909
1910
- Due to internal optimizations, there are certain restrictions on using Arc:
1911
-
1912
- - The arc cannot be filled.
1913
-
1914
- - The arc must be used in an `~.axes.Axes` instance. It can not be added
1915
- directly to a `.Figure` because it is optimized to only render the
1916
- segments that are inside the axes bounding box with high resolution.
1910
+ Due to internal optimizations, the arc cannot be filled.
1917
1911
"""
1912
+
1918
1913
def __str__ (self ):
1919
1914
pars = (self .center [0 ], self .center [1 ], self .width ,
1920
1915
self .height , self .angle , self .theta1 , self .theta2 )
@@ -1997,12 +1992,11 @@ def draw(self, renderer):
1997
1992
with each visible arc using a fixed number of spline segments
1998
1993
(8). The algorithm proceeds as follows:
1999
1994
2000
- 1. The points where the ellipse intersects the axes bounding
2001
- box are located. (This is done be performing an inverse
2002
- transformation on the axes bbox such that it is relative
2003
- to the unit circle -- this makes the intersection
2004
- calculation much easier than doing rotated ellipse
2005
- intersection directly).
1995
+ 1. The points where the ellipse intersects the axes (or figure)
1996
+ bounding box are located. (This is done by performing an inverse
1997
+ transformation on the bbox such that it is relative to the unit
1998
+ circle -- this makes the intersection calculation much easier than
1999
+ doing rotated ellipse intersection directly.)
2006
2000
2007
2001
This uses the "line intersecting a circle" algorithm from:
2008
2002
@@ -2016,8 +2010,6 @@ def draw(self, renderer):
2016
2010
pairs of vertices are drawn using the Bezier arc
2017
2011
approximation technique implemented in `.Path.arc`.
2018
2012
"""
2019
- if not hasattr (self , 'axes' ):
2020
- raise RuntimeError ('Arcs can only be used in Axes instances' )
2021
2013
if not self .get_visible ():
2022
2014
return
2023
2015
@@ -2104,10 +2096,12 @@ def segment_circle_intersect(x0, y0, x1, y1):
2104
2096
& (y0e - epsilon < ys ) & (ys < y1e + epsilon )
2105
2097
]
2106
2098
2107
- # Transforms the axes box_path so that it is relative to the unit
2108
- # circle in the same way that it is relative to the desired ellipse.
2109
- box_path_transform = (transforms .BboxTransformTo (self .axes .bbox )
2110
- + self .get_transform ().inverted ())
2099
+ # Transform the axes (or figure) box_path so that it is relative to
2100
+ # the unit circle in the same way that it is relative to the desired
2101
+ # ellipse.
2102
+ box_path_transform = (
2103
+ transforms .BboxTransformTo ((self .axes or self .figure ).bbox )
2104
+ - self .get_transform ())
2111
2105
box_path = Path .unit_rectangle ().transformed (box_path_transform )
2112
2106
2113
2107
thetas = set ()
0 commit comments