python - Strange... What does [::5,0] mean -
i found webpage explaining how use set_xticks
, . set_xticklabels
.
and set set_xticks
, 'set_xticklabels' following...
ax.set_xticks(xx[::5,0]) ax.set_xticklabels(times[::5]) ax.set_yticks(yy[0,::5]) ax.set_yticklabels(dates[::5])
what [::5,0]
mean..
i don't have idea.....
for numpy array, notation[::5,6]
means take 6th column array , in 6th column, every 5th row starting @ first row till last row.
example -
in [12]: n = np.arange(100000) in [17]: n.shape = (500,200) in [18]: n[::1,2] out[18]: array([ 2, 202, 402, 602, 802, 1002, 1202, 1402, 1602, 1802, 2002, 2202, 2402, 2602, 2802, 3002, 3202, 3402, 3602, 3802, 4002, 4202, 4402, 4602, 4802, .....]) in [19]: n[::5,2] out[19]: array([ 2, 1002, 2002, 3002, 4002, 5002, 6002, ...])
reference on numpy array slicing here , if interested.
Comments
Post a Comment