Skip to content

Commit

Permalink
Add example to ellipse drawing function
Browse files Browse the repository at this point in the history
  • Loading branch information
ahojnnes committed May 27, 2013
1 parent be7a920 commit bc3a804
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions skimage/draw/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ def ellipse(cy, cx, yradius, xradius, shape=None):
May be used to directly index into an array, e.g.
``img[rr, cc] = 1``.
Examples
--------
>>> from skimage.draw import ellipse
>>> img = np.zeros((10, 10), dtype=np.uint8)
>>> rr, cc = ellipse(5, 5, 3, 4)
>>> img[rr, cc] = 1
>>> img
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 0, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
"""

dr = 1 / float(yradius)
Expand Down

0 comments on commit bc3a804

Please sign in to comment.