Thanks Ben. I tried but still confused.
In [8]: fig,ax = plt.subplots()
In [9]: ax.plot(range(100))
Out[9]: [<matplotlib.lines.Line2D at 0x4cadb50>]
In [10]: ax.get_xticks()
Out[10]: array([ 0., 20., 40., 60., 80., 100.])
In [11]: ax.get_yticks()
Out[11]: array([ 0., 20., 40., 60., 80., 100.])
In [12]: draw()
In [13]: cs = ax.imshow(np.arange(100).reshape(10,10))
In [14]: draw()
In [15]: cbar = plt.colorbar(cs,ticks=np.arange(0,100,10))
In [16]: cbar.ax.get_yticks()
Out[16]:
array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , 0.4040404 ,
0.50505051, 0.60606061, 0.70707071, 0.80808081, 0.90909091])
there are many methods avaialbe for cbar.ax.yaxis object:
In [19]: cbar.ax.yaxis.gettick?
cbar.ax.yaxis.get_major_ticks
cbar.ax.yaxis.get_majorticklabels
cbar.ax.yaxis.get_majorticklines
cbar.ax.yaxis.get_majorticklocs
cbar.ax.yaxis.get_minor_ticks
cbar.ax.yaxis.get_minorticklabels
cbar.ax.yaxis.get_minorticklines
cbar.ax.yaxis.get_minorticklocs
cbar.ax.yaxis.get_ticklabel_extents
cbar.ax.yaxis.get_ticklabels
cbar.ax.yaxis.get_ticklines
cbar.ax.yaxis.get_ticklocs
cbar.ax.yaxis.get_ticks_position
I tried
In [20]: cbar.ax.yaxis.get_majorticklocs()
Out[20]:
array([ 0. , 0.1010101 , 0.2020202 , 0.3030303 , 0.4040404 ,
0.50505051, 0.60606061, 0.70707071, 0.80808081, 0.90909091])
But it doesn’t give the tick locs as the normal axes?
could you explain a bit further?
thanks et cheers,
Chao
···
On Tue, Jul 2, 2013 at 5:43 AM, Chao YUE <[hidden email]> wrote:
Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
Dear all matplotlib users,
I found there is not a get_ticks method available for colorbar instance,
how could I quick get the ticks of a colorbar?
thanks,
Chao
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users