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?
[ : , 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).
The plot() function is used to draw points (markers) in a diagram. By default, the plot() function draws a line from point to point.
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 the values in column 0 (from all rows).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With