Answers for "draw polygon in python"

0

python draw polygon

# credit to the Stack Overflow user in the source link

import matplotlib.pyplot as plt

coord = [[1,1], [2,1], [2,2], [1,2], [0.5,1.5]]
coord.append(coord[0]) # repeat the first point to create a 'closed loop'

xs, ys = zip(*coord) # create lists of x and y values

plt.figure()
plt.plot(xs,ys) 
plt.show()
Posted by: Guest on June-02-2021

Python Answers by Framework

Browse Popular Code Answers by Language