On Monday 23 June 2008 13:25:19 John Hunter wrote: > On Mon, Jun 23, 2008 at 11:58 AM, Erik Tollerud <[EMAIL PROTECTED]> wrote: > > Hmm... ok, so it is possible to pass some of the text in a plot > > through TeX, but not all of the text? That's what the text.markup rc > > parameter seems to be about, but I get an error saying that its an > > unrecognized key if I use it... > > No, it's all or none. But with usetex=False you can use mathtext to > format your labels, and then only the stuff in $$ will get formatted > as math using the matplotlib fonts and math layout engine. > > > I could have sworn I saw a post way back where someone managed to get > > the tick numbers to be bold when usetex was on, but I've forgotten how > > it was done and can't find the post now. Anyway, it's possible that > > I'd turned usetex off as a test and not been paying close attention to > > turning it back on... > > You should be able to do this with a custom formatter:: > > import matplotlib.ticker as ticker > > fmtbld = ticker.FormatStrFormatter(r'$\textbf{%1.2f}$') > ax.xaxis.set_major_formatter(fmtbld) > > You should also be able to use textbf in the title, xlabel and ylabel. > > Of course, for this simple solution, you have to hard-code your > precision. To take advantage of all the logic in > ticker.ScalarFormatter, you could inherit from it and override some > key pieces. But it might be better if we provide some hooks for you. > > Darren, in ScalarFormatter.set_format, we have code like:: > > if self._usetex: > self.format = '$%s$' % self.format > elif self._useMathText: > self.format = '$\mathdefault{%s}$' % self.format > > We could consider exposing a font setting here. Something along the lines > of > > self.fontcommand = None > if self._usetex: > if self.fontcommand = None: > self.format = '$%s$' % self.format > else: > self.format = '$%s{%s}$' % (self.fontcommand, self.format) > > Then the user could do:: > > formatter = ticker.ScalarFormatter() > formatter.fontcommand = r'\mathbf' > > and something similar for mathtext.
I'm not excited about adding user-accessible, usetex-specific properties and methods to classes outside of rcParams. It was a fair amount of work integrating as much customizability as we have now via rcParams, but we don't have the resources to support all the font properties in rcParams in usetex. I think it would be best to just use a custom formatter for this. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users