Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbc1b19

Browse filesBrowse files
authored
Merge pull request #23336 from anntzer/a
Remove ineffective exclusion of Arcs without parent Axes.
2 parents a2ad1f7 + cf995d1 commit cbc1b19
Copy full SHA for cbc1b19

File tree

Expand file treeCollapse file tree

1 file changed

+13
-19
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-19
lines changed

‎lib/matplotlib/patches.py

Copy file name to clipboardExpand all lines: lib/matplotlib/patches.py
+13-19Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,14 +1907,9 @@ class Arc(Ellipse):
19071907
"""
19081908
An elliptical arc, i.e. a segment of an ellipse.
19091909
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.
19171911
"""
1912+
19181913
def __str__(self):
19191914
pars = (self.center[0], self.center[1], self.width,
19201915
self.height, self.angle, self.theta1, self.theta2)
@@ -1997,12 +1992,11 @@ def draw(self, renderer):
19971992
with each visible arc using a fixed number of spline segments
19981993
(8). The algorithm proceeds as follows:
19991994
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.)
20062000
20072001
This uses the "line intersecting a circle" algorithm from:
20082002
@@ -2016,8 +2010,6 @@ def draw(self, renderer):
20162010
pairs of vertices are drawn using the Bezier arc
20172011
approximation technique implemented in `.Path.arc`.
20182012
"""
2019-
if not hasattr(self, 'axes'):
2020-
raise RuntimeError('Arcs can only be used in Axes instances')
20212013
if not self.get_visible():
20222014
return
20232015

@@ -2104,10 +2096,12 @@ def segment_circle_intersect(x0, y0, x1, y1):
21042096
& (y0e - epsilon < ys) & (ys < y1e + epsilon)
21052097
]
21062098

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())
21112105
box_path = Path.unit_rectangle().transformed(box_path_transform)
21122106

21132107
thetas = set()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.