我想散点图一个两列数据看起来如下(打印)
0 0.195871-0.008693j 0.117586+0.001306j
1 0.219024+0.003791j 0.132911-0.007069j
2 0.271063-0.009686j -0.135223+0.007258j
3 0.279217-0.010561j 0.174209-0.004157j
4 0.194862+0.017081j 0.108965+0.007829j
... ... ...
9994 0.398795+0.035182j -0.068538+0.017619j
9995 0.540517+0.059227j -0.250704+0.027940j
9996 0.218166-0.010739j 0.131059-0.008267j
9997 0.285605+0.035444j -0.051080+0.018130j
9998 0.185130+0.009470j 0.113928+0.009426j
[9999 rows x 2 columns]
我不知道上面j是什么意思。无论如何,我写道:
plt.xlabel('LD1')
plt.ylabel('LD2')
plt.scatter(
X_lda.iloc[:,0],
X_lda.iloc[:,1],
c=1,
cmap='rainbow')
但它将:
/usr/local/lib/python3.6/dist-packages/matplotlib/axes/_axes.py in _parse_scatter_color_args(c, edgecolors, kwargs, xshape, yshape, get_next_color_func)
4262 try: # First, does 'c' look suitable for value-mapping?
4263 c_array = np.asanyarray(c, dtype=float)
-> 4264 n_elem = c_array.shape[0]
4265 if c_array.shape in [xshape, yshape]:
4266 c = np.ma.ravel(c_array)
IndexError: tuple index out of range
问题来源StackOverflow 地址:/questions/59466371/tuple-index-out-of-range-in-scatter-plot
表格有7列,insert只给了4个值。
insert(self, index, *args) Similar to Tkinter.Listbox.insert(), except that instead of one string a number of strings equal to the number of columns must be given as arguments. It is an error to specify more or fewer arguments than the number of columns. Returns the ID of the newly created item, as returned by item_create().
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。