On Do, 2014-05-01 at 09:45 -0400, Benjamin Root wrote:
> By default, the hold is already True. In fact, that might explain some
> of the differences in what you are seeing. There are more points in
> the second image than in the first one, so I wonder if you are seeing
> some leftovers of previous plot commands?
> 
> 
> One issue I do see is that the slicing is incorrect. [0:3] means index
> 0, 1, and 2.  So index 3 is never accessed.  I think you want [0:4].
> 
> 
> I should also note that once you have your data as a numpy array, your
> indexing can be greatly simplified:
> plt.plot(array4D[0][0][0:4][0],array4D[0][0][0:4][0],'bo')
> 
> can be done as:
> plt.plot(array4D[0, 0, 0:4, 0], array4D[0, 0, 0:4, 0], 'bo')
> 

Yeah, also arr[0:4][0] is the same as arr[0]. So you actually *must* use
an array and the arr[0:4, 0] way if you want to do indexing like that...

- Sebastian

> 
> Cheers!
> Ben Root
> 
> 
> 
> On Thu, May 1, 2014 at 8:33 AM, Eelco Hoogendoorn
> <hoogendoorn.ee...@gmail.com> wrote:
>         You problem isn't with colon indexing, but with the
>         interpretation of the arguments to plot. multiple calls to
>         plot with scalar arguments do not have the same result as a
>         single call with array arguments. For this to work as
>         intended, you would need plt.hold(True), for starters, and
>         maybe there are other subtleties.
>         
>         
>         On Thu, May 1, 2014 at 1:31 PM, did did <21di...@gmx.com>
>         wrote:
>         
>                 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 
>                 
>                 _______________________________________________
>                 NumPy-Discussion mailing list
>                 NumPy-Discussion@scipy.org
>                 http://mail.scipy.org/mailman/listinfo/numpy-discussion
>                 
>         
>         
>         
>         _______________________________________________
>         NumPy-Discussion mailing list
>         NumPy-Discussion@scipy.org
>         http://mail.scipy.org/mailman/listinfo/numpy-discussion
>         
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to