An elliptical arc, i.e. a segment of an ellipse. Due to internal optimizations, the arc cannot be filled.
| 2108 | |
| 2109 | |
| 2110 | class Arc(Ellipse): |
| 2111 | """ |
| 2112 | An elliptical arc, i.e. a segment of an ellipse. |
| 2113 | |
| 2114 | Due to internal optimizations, the arc cannot be filled. |
| 2115 | """ |
| 2116 | |
| 2117 | def __str__(self): |
| 2118 | pars = (self.center[0], self.center[1], self.width, |
| 2119 | self.height, self.angle, self.theta1, self.theta2) |
| 2120 | fmt = ("Arc(xy=(%g, %g), width=%g, " |
| 2121 | "height=%g, angle=%g, theta1=%g, theta2=%g)") |
| 2122 | return fmt % pars |
| 2123 | |
| 2124 | @_docstring.interpd |
| 2125 | def __init__(self, xy, width, height, *, |
| 2126 | angle=0.0, theta1=0.0, theta2=360.0, **kwargs): |
| 2127 | """ |
| 2128 | Parameters |
| 2129 | ---------- |
| 2130 | xy : (float, float) |
| 2131 | The center of the ellipse. |
| 2132 | |
| 2133 | width : float |
| 2134 | The length of the horizontal axis. |
| 2135 | |
| 2136 | height : float |
| 2137 | The length of the vertical axis. |
| 2138 | |
| 2139 | angle : float |
| 2140 | Rotation of the ellipse in degrees (counterclockwise). |
| 2141 | |
| 2142 | theta1, theta2 : float, default: 0, 360 |
| 2143 | Starting and ending angles of the arc in degrees. These values |
| 2144 | are relative to *angle*, e.g. if *angle* = 45 and *theta1* = 90 |
| 2145 | the absolute starting angle is 135. |
| 2146 | Default *theta1* = 0, *theta2* = 360, i.e. a complete ellipse. |
| 2147 | The arc is drawn in the counterclockwise direction. |
| 2148 | Angles greater than or equal to 360, or smaller than 0, are |
| 2149 | represented by an equivalent angle in the range [0, 360), by |
| 2150 | taking the input value mod 360. |
| 2151 | |
| 2152 | Other Parameters |
| 2153 | ---------------- |
| 2154 | **kwargs : `~matplotlib.patches.Patch` properties |
| 2155 | Most `.Patch` properties are supported as keyword arguments, |
| 2156 | except *fill* and *facecolor* because filling is not supported. |
| 2157 | |
| 2158 | %(Patch:kwdoc)s |
| 2159 | """ |
| 2160 | fill = kwargs.setdefault('fill', False) |
| 2161 | if fill: |
| 2162 | raise ValueError("Arc objects cannot be filled") |
| 2163 | |
| 2164 | super().__init__(xy, width, height, angle=angle, **kwargs) |
| 2165 | |
| 2166 | self.theta1 = theta1 |
| 2167 | self.theta2 = theta2 |
no outgoing calls