Ask Your Question

# iterating plots

I want to plot several polygon whose coordonates are in a list. I know that we can add plot or use =+. But I wonder if there is a mechanism as sum() which can be iterated. For instance, this gives an error

l=list([1, 2, 3, 5])
ll=list([10, 20, 30, 40])
sum(plot(polygon([(l[j],0),(l[j],ll[j]),(l[j+1],ll[j]),(l[j+1],0)]) for j in range(len(l)-1)))

edit retag close merge delete

## 1 Answer

Sort by » oldest newest most voted Comme ca:

sum(plot(cos(x+i/100),0,1) for i in range(10))

more

## Comments

Thanks FrédéricC, but in my case (may be an error) it doesn't work. I have added my code.

Faut mettre les parentheses au bon endroit.

l=list([1, 2, 3, 5])
ll=list([10, 20, 30, 40])
sum(plot(polygon([(l[j],0),(l[j],ll[j]),(l[j+1],ll[j]),(l[j+1],0)])) for j in range(len(l)-1))


## Your Answer

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

Add Answer

## Stats

Asked: 2020-06-19 17:06:06 +0200

Seen: 72 times

Last updated: Jun 19 '20