我按照此处的示例运行了以下代码:
http://matplotlib.org/faq/howto_faq.html#test-whether-a-point-is-inside-a-polygon
非常感谢您的帮助。谢谢你。
>>>import numpy as np
>>>import matplotlib.nxutils as nx
>>>verts = np.array([ [0,0], [0, 1], [1, 1], [1,0]], float)
>>>nx.pnpoly(0.5, 0.5, verts)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\matplotlib\nxutils.py", line 26, in pnpoly
return p.contains_point(x, y)
File "C:\Python27\lib\site-packages\matplotlib\path.py", line 289, in contains_point
transform = transform.frozen()
AttributeError: 'float' object has no attribute 'frozen'
>>>nx.pnpoly(0.5, 1.5, verts)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python27\lib\site-packages\matplotlib\nxutils.py", line 26, in pnpoly
return p.contains_point(x, y)
File "C:\Python27\lib\site-packages\matplotlib\path.py", line 289, in contains_point
transform = transform.frozen()
AttributeError: 'float' object has no attribute 'frozen'