I found a webpage which explaining how to use set_xticks
and . set_xticklabels
.
And they set set_xticks
and 'set_xticklabels' as following...
ax.set_xticks(xx[::5,0])
ax.set_xticklabels(times[::5])
ax.set_yticks(yy[0,::5])
ax.set_yticklabels(dates[::5])
What does [::5,0]
exactly mean..
I don't have any idea.....
For a numpy array, the notation[::5,6]
means to take the 6th column for that array and then in the 6th column, every 5th row starting at the first row till the 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 you are interested.
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