matplotlib: dynamically generated Tex xlabels

Dear, All,

I am using matplotlib's rc to label x axes:
rc('text', usetex=True)
pl.xlabel(r'\textbf{Residue}')
I would like to use something more dynamic like:

la='5';pl.xlabel(r'\textbf{Residue }%s',fontsize=18) %la

But i get:
TypeError: unsupported operand type(s) for %: 'instance' and 'str'
if la is float and int the error is reported accordingly..

How would be the best way to go about it?

with eval I was aiming at resolving the problem but so far I failed...

best regards
Juergen

Move the %la inside:
xlabel(r'\textbf{Residue }%s'%la,fontsize=18)

ยทยทยท

On 3/22/06, Juergen Haas <jhaas@...1056...> wrote:

Dear, All,

I am using matplotlib's rc to label x axes:
rc('text', usetex=True)
pl.xlabel(r'\textbf{Residue}')
I would like to use something more dynamic like:

la='5';pl.xlabel(r'\textbf{Residue }%s',fontsize=18) %la

But i get:
TypeError: unsupported operand type(s) for %: 'instance' and 'str'
if la is float and int the error is reported accordingly..

How would be the best way to go about it?

with eval I was aiming at resolving the problem but so far I failed...

best regards
Juergen

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options