From: Malte M. <Mal...@cs...> - 2006-04-18 03:30:34
|
Hi, I have a related question. How do I change the (font)size of the ticklabels, without having to step through them? I have "ganged" plots and am scaling fonts by a factor depending on nrows and ncolumns. I also need this for the size of the legend "labels" Cheers, Malte On Friday 14 April 2006 04:25, Ryan Krauss wrote: > The new formatter works pretty well. One change though, the last line > should be: > > else: return LogFormatterMathtext.__call__(self, x, pos) > > Thanks, > > John > > On 4/13/06, John Hunter <jdh...@ac...> wrote: > > >>>>> "Ryan" == Ryan Krauss <rya...@gm...> writes: > > > > Ryan> My love of large fonts is causing a problem. If you look at > > Ryan> the attached figure, I typically have x and y tick marks > > Ryan> that nearly collide in the lower left hand corner of each > > Ryan> subplot. I typically end up setting the yticks by hand, but > > Ryan> this isn't super convienent for each plot. I am about to > > Ryan> right a function to drop the lowest ytick label, but is > > Ryan> there a better approach? > > > > Increase the xtick.major.pad and/or ytick.major.pad rc settings by a > > couple of points. > > > > Alternatively, if you do want to drop the leftmost xtick label, for > > instance, you can easily derive a custom formatter. Here you are using > > the LogFormatterMathtext > > > > from matplotlib.ticker import LogFormatterMathtext > > > > class MyFormatter(LogFormatterMathtext): > > def __call__(self, x, pos=None): > > if pos==0: return '' # pos=0 is the first tick > > else: return LogFormatterMathtext(self, x, pos) > > > > ax.xaxis.set_major_formatter(MyFormatter()) > > > > Nice looking figure! > > JDH > |