From: <hu...@ya...> - 2006-10-31 20:54:14
|
Hi, I have different questions to use tex with matplotlib. The first one: If I'm doing: rc('text', usetex=True) xlabel('$\textrm{toto}$') # bad xlabel(r'$\textrm{toto}$') # ok The results are not the same and I don't understand why. and for: xlabel('$\textit{toto}$') #bad xlabel(r'$\textit{toto}$') #ok same things, but it's working fine for: xlabel('$\it{toto}$') #ok xlabel(r'$\it{toto}$') #ok but it's not working for \bf: xlabel('$\textbf{toto}$') # bad xlabel(r'$\textbf{toto}$') # ok xlabel('$\bf{toto}$') # bad xlabel(r'$\bf{toto}$') # ok And this bring to the second question, I would like to create the xlabel with latex stuf inside somewhere in my script: label='$\textrm{test}_2$' but that can't work: xlabel(label) # bad How to tell that I want the "r" before the chains to have TeX working like expected? Thanks, N. |