prtools.ellipse#

ellipse(shape, xradius, yradius, shift=(0, 0), angle=0, antialias=True, indexing='ij')[source]#

Draw an ellipse

Parameters:
  • shape (array_like) – Size of output in pixels (nrows, ncols)

  • xradius (float) – Semi-axis of the ellipse in pixels in the x (horizontal) direction.

  • yradius (float) – Semi-axis of the ellipse in pixels in the y (vertical) direction.

  • shift ((2,) array_like, optional) – How far to shift center in float (rows, cols). Default is (0, 0).

  • angle (float, optional) – Rotation of the ellipse in degrees counterclockwise from horizontal. Default is 0.

  • antialias (bool, optional) – If True (default), the shape edges are antialiased.

  • indexing ({'ij', 'xy'}, optional) – Matrix (‘ij’, default) or cartesian (‘xy’) indexing of output.

Return type:

ndarray

Examples

>>> ell = prtools.ellipse(shape=(256, 256), xradius=100, yradius=50)
>>> plt.imshow(ell, cmap='gray')
../_images/prtools-ellipse-1.png
>>> ell = prtools.ellipse(shape=(256, 256), xradius=100, yradius=50, angle=30)
>>> plt.imshow(ell, cmap='gray')
../_images/prtools-ellipse-2.png