[Numpy-discussion] arrays and : behaviour

did did 21did21 at gmx.com
Thu May 1 07:31:26 EDT 2014


Hello all and sorry for my bad english,

i am a beginner with python and i try to save a lot of data in several folders in a 4D matrix
and then to plot two columns of this 4D matrix.

Bellow, i have the code to fill my 4D matrix, it works very well :

[CODE]matrix4D=[]
for i in Numbers:
 readInFolder=folderPrefixe+i+"/"
 matrix3D=[]
 for j in listeOfdata:
 nameOfFile=filePrefixe+i+"-"+j+extensionTXT
 nameOfFile=readInFolder+nameOfFile
 matrix2D=np.loadtxt(nameOfFile,delimiter=",",skiprows=1)
 matrix3D.append(matrix2D)
 matrix4D.append(matrix3D)
array4D = np.asarray(matrix4D)[/CODE]

But now, i want to plot the third column as function of the third too (just for trying) and i use
this stupid manner that works well :

[CODE]plt.figure(1)
temp=plt.plot(array4D[0][0][0][0],array4D[0][0][0][0],'bo')
temp=plt.plot(array4D[0][0][1][0],array4D[0][0][1][0],'bo')
temp=plt.plot(array4D[0][0][2][0],array4D[0][0][2][0],'bo')
temp=plt.plot(array4D[0][0][3][0],array4D[0][0][3][0],'bo')
plt.show()[/CODE]

Now, i want to use a more smart manner and i use ":" like this

[CODE]plt.figure(1)
temp=plt.plot(array4D[0][0][0:3][0],array4D[0][0][0:3][0],'bo')
plt.show()[/CODE]

The result should be the same but i don't got the same results!!!

In attachement you have the two corresponding plots, can you explain to me with
i don't have the same plots ??

thanks for all
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140501/22484799/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: normal.jpeg
Type: image/jpeg
Size: 18436 bytes
Desc: Attachment: normal.jpeg
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140501/22484799/attachment.jpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: withTwoPoints.jpeg
Type: image/jpeg
Size: 18540 bytes
Desc: Attachment: withTwoPoints.jpeg
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140501/22484799/attachment-0001.jpeg>


More information about the NumPy-Discussion mailing list