prtools.rectangle#

rectangle(shape, width, height, shift=(0, 0), angle=0, antialias=True, indexing='ij')[source]#

Draw a rectangle

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

  • width (float) – Width of rectangle in pixels

  • height (float) – Height of rectangle in pixels

  • shift (tuple of floats, optional) – How far to shift center. Default is (0, 0).

  • angle (float, optional) – Mesh rotation in degrees. When indexing = 'xy' the rotation is measured from the +x axis toward the +y axis. When indexing = 'ij' the rotation is measured from the +i axis toward the +j axis. Note that rotations occur about the shifted center if shift is nonzero. 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 shift.

Return type:

ndarray

Examples

>>> rect = prtools.rectangle(shape=(256,256), width=200, height=100)
>>> plt.imshow(rect, cmap='gray')
../_images/prtools-rectangle-1.png