您好我正在尝试从文本文件加载坐标以进行绘图,但我不断收到一个我不明白的错误。文件中的坐标如下所示这(0.1, 0.0, 0.0),
(0.613125, 0.52202, 0.19919)
是我要运行的代码:
from visual import *
with open ('/Desktop/Coordlist2.txt','r') as open_file:
rightFace = curve(pos=[(1,-1,-1), (1,-1,1), (1,-1,-1),(1,1,-1),(1,1,-1),(1,1,1),(1,1,1),(1,-1,1)], radius=0.01, color=color.cyan)
backFace = curve(pos=[(1,-1,-1), (-1,-1,-1), (-1,-1,-1),(-1,1,-1),(-1,1,-1),(1,1,-1)], radius=0.01, color=color.cyan)
leftFace = curve(pos=[(-1,-1,-1), (-1,-1,1), (-1,-1,1),(-1,1,1),(-1,1,1),(-1,1,-1)], radius=0.01, color=color.cyan)
frontFace = curve(pos=[(-1,-1,1), (1,-1,1), (1,1,1),(-1,1,1)], radius=0.01, color=color.cyan)
for line in open_file.readlines():
coords = line
points(pos=[coords], size=1, color=color.yellow)
这是我收到的错误消息:
Traceback (most recent call last):
File "/Users/Graphs.py", line 15, in <module>
points(pos=[coords], size=1, color=color.yellow)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vis/primitives.py", line 84, in __init__
self.process_init_args_from_keyword_dictionary( keywords )
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vis/primitives.py", line 212, in process_init_args_from_keyword_dictionary
setattr(self, key, value)
ValueError: Object cannot be converted to array.
任何帮助将不胜感激