Pages

jeudi 22 mars 2012

change the ticks labels in python

temp_figure = figure()
ax1 = temp_figure.gca()
ax1.xaxis.set_major_locator(MaxNLocator(len(data)))


for templabel in ax1.xaxis.get_ticklabels():
        templabel.set_fontsize(8)
        templabel.set_color('red')
        templabel.set_rotation(45)

for line in  ax1.xaxis.get_ticklines():  
        line.set_color('red')     
        line.set_markersize(25)
        line.set_markeredgewidth(3)

NOTE: Note that the MaxNLocator sets the maximum number of *intervals* so the max number of ticks will
be the max number of intervals plus one. 

Aucun commentaire:

Enregistrer un commentaire