| 
     
      
      
      From: konstellationen <kon...@gm...> - 2010-04-10 01:15:38
      
     
   | 
For future reference, the solution proposed by Gökhan and Diakronik is to
replace the Latex tick-labels with strings:
>import matplotlib.pyplt as plt
>tick_locs = range(start, stop, increment)
>plt.xticks(tick_locs, [r"$\mathbf{%s}$" % x for x in tick_locs]) 
If you have twin x or y axes (my case), the solution I found was: 
(Note: this solution is essentially the same as the one above, with the
distinction that every entry is set manually, which allows for more
flexibility, but requires more work)
>from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
>from matplotlib.pylab import *   # For plotting graphs.
>from matplotlib.pyplot import *
>fig=figure(1)
>host= SubplotHost(fig,111)
>fig.add_subplot(host)
>par=host.twiny()
>host.axis["bottom"]
>par.axis["top"]
>hostv=[1e-14,1e-4,-1.5,1.5]
>host.axis(hostv)
>parv=[1e-8,1e2,-1.5,0.5]
>par.axis(parv)
>host.set_xticks([1e-14, ... ,1e-4])
>x_labels = [r'\boldmath $10^{-14} $', ... ,r'\boldmath $ $']
>host.set_xticklabels(x_labels)
>par.set_xticks([1e-8, ... ,1e2])
>parx_labels = [ r'\boldmath $10^{-8}$', ... ,r'\boldmath $ $' ]
>par.set_xticklabels(parx_labels)
>host.set_yticks([-1,0])
>y_labels = [r'\boldmath $-1$', r'\boldmath $0$']
>host.set_yticklabels(y_labels)
Result: 
http://old.nabble.com/file/p28199345/Picture%2B7.png 
-- 
View this message in context: http://old.nabble.com/Bold-Latex-Tick-Labels-tp28037900p28199345.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
 |