First time here? Check out the FAQ!

Ask Your Question
1

How to draw figures of Polygons in SageMath

asked 6 years ago

Captcha gravatar image

I want to draw a picture of a polygon in SageMath which will be unfilled i.e I want to draw figures of triangle,square,pentagon,hexagon and so on and then draw a figure with say 100 sides.

I checked the web.

I only found plots of 3d figures ,I want 2d figures .

Is it possible to draw such a figure in SageMath.

Please help me

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 6 years ago

slelievre gravatar image

updated 6 years ago

Just use fill=False.

For example, let us draw a regular 12-gon.

sage: p = RDF.pi()
sage: n = 12
sage: pol = polygon([(cos(2*k*p/n), sin(2*k*p/n)) for k in range(n)], fill=False)
sage: pol.show(aspect_ratio=1)
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 6 years ago

Seen: 1,158 times

Last updated: Mar 22 '18