Add check for even array length when using arrayToQPath(connect='pairs')
This commit is contained in:
parent
5b6bc6715c
commit
ab0729bb04
@ -1157,6 +1157,8 @@ def arrayToQPath(x, y, connect='all'):
|
|||||||
# decide which points are connected by lines
|
# decide which points are connected by lines
|
||||||
if connect == 'pairs':
|
if connect == 'pairs':
|
||||||
connect = np.empty((n/2,2), dtype=np.int32)
|
connect = np.empty((n/2,2), dtype=np.int32)
|
||||||
|
if connect.size != n:
|
||||||
|
raise Exception("x,y array lengths must be multiple of 2 to use connect='pairs'")
|
||||||
connect[:,0] = 1
|
connect[:,0] = 1
|
||||||
connect[:,1] = 0
|
connect[:,1] = 0
|
||||||
connect = connect.flatten()
|
connect = connect.flatten()
|
||||||
|
Loading…
Reference in New Issue
Block a user