An elliptical annulus.
| 1879 | |
| 1880 | |
| 1881 | class Annulus(Patch): |
| 1882 | """ |
| 1883 | An elliptical annulus. |
| 1884 | """ |
| 1885 | |
| 1886 | @_docstring.interpd |
| 1887 | def __init__(self, xy, r, width, angle=0.0, **kwargs): |
| 1888 | """ |
| 1889 | Parameters |
| 1890 | ---------- |
| 1891 | xy : (float, float) |
| 1892 | xy coordinates of annulus centre. |
| 1893 | r : float or (float, float) |
| 1894 | The radius, or semi-axes: |
| 1895 | |
| 1896 | - If float: radius of the outer circle. |
| 1897 | - If two floats: semi-major and -minor axes of outer ellipse. |
| 1898 | width : float |
| 1899 | Width (thickness) of the annular ring. The width is measured inward |
| 1900 | from the outer ellipse so that for the inner ellipse the semi-axes |
| 1901 | are given by ``r - width``. *width* must be less than or equal to |
| 1902 | the semi-minor axis. |
| 1903 | angle : float, default: 0 |
| 1904 | Rotation angle in degrees (anti-clockwise from the positive |
| 1905 | x-axis). Ignored for circular annuli (i.e., if *r* is a scalar). |
| 1906 | **kwargs |
| 1907 | Keyword arguments control the `Patch` properties: |
| 1908 | |
| 1909 | %(Patch:kwdoc)s |
| 1910 | """ |
| 1911 | super().__init__(**kwargs) |
| 1912 | |
| 1913 | self.set_radii(r) |
| 1914 | self.center = xy |
| 1915 | self.width = width |
| 1916 | self.angle = angle |
| 1917 | self._path = None |
| 1918 | |
| 1919 | def __str__(self): |
| 1920 | if self.a == self.b: |
| 1921 | r = self.a |
| 1922 | else: |
| 1923 | r = (self.a, self.b) |
| 1924 | |
| 1925 | return "Annulus(xy=(%s, %s), r=%s, width=%s, angle=%s)" % \ |
| 1926 | (*self.center, r, self.width, self.angle) |
| 1927 | |
| 1928 | def set_center(self, xy): |
| 1929 | """ |
| 1930 | Set the center of the annulus. |
| 1931 | |
| 1932 | Parameters |
| 1933 | ---------- |
| 1934 | xy : (float, float) |
| 1935 | """ |
| 1936 | self._center = xy |
| 1937 | self._path = None |
| 1938 | self.stale = True |
no outgoing calls
searching dependent graphs…