0

I am trying to create a plot similar to the one in this post. I'm not sure why, but when I run the following code, I get an error:

df1 = pd.DataFrame(list(zip(single_frag_cnv_sizes, single_frag_cn)), columns=['x','y'])
df2 = pd.DataFrame(list(zip(multi_frag_cnv_sizes, multi_frag_cn)), columns=['x','y'])
df3 = pd.DataFrame(list(zip(total_cnv_sizes, total_cn)), columns=['x','y'])
df1['kind'] = 'single_frag'
df2['kind'] = 'multi_frag'
df3['kind'] = 'total'
df=pd.concat([df1,df2,df3], ignore_index = True)

grid = sbn.JointGrid(x='x', y='y', data=df)

g = grid.plot_joint(sbn.scatterplot, hue='kind', data=df)

produces the ValueError array length 38210 does not match index length 38321.

I've double checked that the arrays I'm creating dataframes for are the same length:

print(len(single_frag_cnv_sizes))
print(len(multi_frag_cnv_sizes))
print(len(total_cnv_sizes))
print(len(single_frag_cn))
print(len(multi_frag_cn))
print(len(total_cn))

13626
5122
19573
13626
5122
19573

Does anyone see an error?

Victor M
  • 603
  • 4
  • 22

0 Answers0