<div dir="ltr">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.</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 1, 2014 at 1:31 PM, did did <span dir="ltr"><<a href="mailto:21did21@gmx.com" target="_blank">21did21@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span style="font-family:Verdana"><span style="font-size:12px">Hello all and sorry for my bad english,<br><br>i am a beginner with python and i try to save a lot of data in several folders in a 4D matrix<br>and then to plot two columns of this 4D matrix.<br>
<br>Bellow, i have the code to fill my 4D matrix, it works very well :<br><br>[CODE]matrix4D=[]<br>for i in Numbers:<br>    readInFolder=folderPrefixe+i+"/"<br>    matrix3D=[]<br>    for j in listeOfdata:<br>        nameOfFile=filePrefixe+i+"-"+j+extensionTXT<br>
        nameOfFile=readInFolder+nameOfFile<br>        matrix2D=np.loadtxt(nameOfFile,delimiter=",",skiprows=1)<br>        matrix3D.append(matrix2D)<br>    matrix4D.append(matrix3D)<br>array4D = np.asarray(matrix4D)[/CODE]<br>
<br>But now, i want to plot the third column as function of the third too (just for trying) and i use<br>this stupid manner that works well :<br><br>[CODE]plt.figure(1)<br>temp=plt.plot(array4D[0][0][0][0],array4D[0][0][0][0],'bo')<br>
temp=plt.plot(array4D[0][0][1][0],array4D[0][0][1][0],'bo')<br>temp=plt.plot(array4D[0][0][2][0],array4D[0][0][2][0],'bo')<br>temp=plt.plot(array4D[0][0][3][0],array4D[0][0][3][0],'bo')<br>plt.show()[/CODE]<br>
<br>Now, i want to use a more smart manner and i use ":" like this<br><br>[CODE]plt.figure(1)<br>temp=plt.plot(array4D[0][0][0:3][0],array4D[0][0][0:3][0],'bo')<br>plt.show()[/CODE]<br><br>The result should be the same but i don't got the same results!!!<br>
<br>In attachement you have the two corresponding plots, can you explain to me with<br>i don't have the same plots ??<br><br>thanks for all</span></span>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>