Skip to content
Related Articles

Related Articles

Improve Article

Wand path_elliptic_arc() function in Python

  • Last Updated : 10 May, 2020

path_elliptic_arc() is a function specially introduced for paths. path_elliptic_arc() draws an elliptical arc from current point to a particular point we want the arc to drawn to.
Let’s see parameters needed for this function.

Syntax :

wand.drawing.path_elliptic_arc(to, radius, rotation, large_arc, clockwise, relative)

Parameters:

ParameterInput TypeDescription
tosequence or (numbers.Real, numbers.Real)pair which represents coordinates to draw to.
radiuscollections.abc.sequence or (numbers.Real, numbers.Real)pair which represents the radii of the ellipse to draw.
rotatebooldegree to rotate ellipse on x-axis.
large_arcbooldraw largest available arc.
clockwisebooldraw arc path clockwise from start to target.
relativebooltreat given coordinates as relative to current point.

Example : Draw an elliptical curve.




from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
  
with Drawing() as draw:
    draw.stroke_width = 2
    draw.stroke_color = Color('black')
    draw.fill_color = Color('white')
    draw.path_start()
    # Start middle-left
    draw.path_move(to =(10, 100))
    # draw elliptical curve
    draw.path_elliptic_arc(to =(10, 180),
                           radius = (20, 40),
                           rotation = 270,
                           large_arc = True,
                           clockwise = True,
                           relative = True )
    with Image(width = 200, height = 200, background = Color('lightgreen')) as image:
        draw(image)
        image.save(filename ="pathecurve.png")

Output :

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :