There is no problem when I run in python 2.7 but I am getting error when I run in python 3.
Is there something that I need to change in this code.
import matplotlib as mpl
poly = mpl.path.Path(zip(listx,listy))
error that I am getting is
TypeError: float() argument must be a string or a number, not 'zip'
This is because in python2 zip()
returns a list of tuples, which mpl.path.Path()
happily accepts. In python3, zip()
returns an iterator, which you must consume. You should be able to do something like:
>>> poly = mpl.path.Path(list(zip(listx, listy)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With