From: Benjamin R. <ben...@ou...> - 2012-03-01 18:18:23
|
On Thu, Mar 1, 2012 at 11:33 AM, Pawel <pa...@gm...> wrote: > Hi all, > > Is it possible to set the size of only some tick labels? I have text > tick labels (residue names). I'd like to reduce the font size of just > two of the labels to make them fit better, but keep the size of the > remaining labels the same. > > It isn't _impossible_, but mpl certainly won't make it easy for you. After creating your graph and tick labels, you would have to get back the tick labels as a list of Text objects using "get_xticklabels()". Then, you modify the font size of the appropriate element in that list. Perhaps something like this: xticks = ax.get_xticklabels() xticks[3].set_fontsize(xticks[3].get_fontsize() * 0.9) Note: Completely untested. > And in a similar vein, is it possible to change the padding of just some > tick labels? Again, I'd like to increase the padding of just two of the > labels but keep the remaining the same. > > By "padding" are you referring to the spacing between the tick labels? That would have to be done by changing the tick locations themselves. By default, the ticks are equally spaced over the specified domain, and the labels for those ticks are placed so that the center lines up with the tick mark. Try using "get_xticks()" and "set_yticks()" and see what happens. I hope that helps! Ben Root |