Eric Firing wrote: > Xavier Gnata wrote: >> Hi all, >> >> I looking for a way to modify the colorbar ticks font size. >> a=rand(100,100) >> imshow(a) >> colorbar() >> and then?? >> >> For instance, xticks(fontsize=20) works well to modify the ticks >> fontsize along the X-axis but colorbar(fontsize=20) does not exists. >> I must be missing something. > > cb = colorbar() # grab the Colorbar instance > for t in cb.ax.get_yticklabels(): > t.set_fontsize(20) > > The colorbar function makes a new axes object, the "ax" attribute of > the Colorbar instance returned by the colorbar function. From that > you get the list of text objects, which you then modify. > > The pylab xticks and yticks functions make the retrieval and > modification of the text objects easier, but they operate only on the > "current axes", and the colorbar leaves the image axes as current. > > An alternative method is to change the current axes: > > imaxes = gca() > axes(cb.ax) > yticks(fontsize=20) > axes(imaxes) > > > Here I saved and restored the original axes in case you want to do > something with the image axes after modifying the colorbar. > > Eric > Hi,
Your first method is not working on my box (no change) but the second one is just fine :) However, it is not as intuitive as other matplotlib ways of doing things. Is there a simple way to modify the colorbar code to get something like colorbar(fontsize=20) work ? Or maybe as a method like that : cb=colorbar() cb.set_fontsize(20) Any comments ? Xavier -- ############################################ Xavier Gnata CRAL - Observatoire de Lyon 9, avenue Charles André 69561 Saint Genis Laval cedex Phone: +33 4 78 86 85 28 Fax: +33 4 78 86 83 86 E-mail: [EMAIL PROTECTED] ############################################ ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users