14

I am plotting a graph using plt.plot using information found online.

However, I do not know what the y[:,0] means:

    plt.plot(t, y[:,0], label= 'active Mos') 

Similarly, I see y[:,1] a lot too...

plt.plot is to plot a line to the graph, right?

Hotaru
  • 147
  • 1
  • 1
  • 6
  • Went through it but cannot see the , in the notation anywhere... if the , wasnt there i could understand but... – Hotaru Nov 11 '16 at 23:58

1 Answers1

48

It is a notation used in Numpy/Pandas.

[ : , 0 ] means (more or less) [ first_row:last_row , column_0 ]. If you have a 2-dimensional list/matrix/array, this notation will give you all values in column 0 (from all rows).

furas
  • 134,197
  • 12
  • 106
  • 148