adding whitespace to plot title?

Hi, I'm having the worst time formatting my plot title in Python using
matplotlib.
I want the title to read

"delta^15N and TL for" name "food web"

where delta should be the greek symbol, 15 should be superscript, and the
title takes the user-supplied string variable, name, and adds it in to
the string.

From what I've tried, I can either get the symbol/superscript formatting
correct and lose all the rest of the text (or have it squished together
with no whitespace) or no math formatting at all.

This is the best I've been able to do:

title(r'$\delta^{15}N and Trophic Level for Food Web$')

which gives me a good result, but no whitespace and no way to add in the
file name on the fly. (This is a program that processes a file you give
it and gives you a plot of the results)

Anyone out there know a command to manually add a space? Is there
something equivalent to \t or \n?

Thanks!

Carla A. Ng

···

===================================
Northwestern University
Department of Chemical and Biological Engineering
2145 North Sheridan Road
Evanston, IL 60208
Phone: (847)467-4980
Fax: (847)491-4011

"When one tugs at a single thing in nature, he finds it attached to the
rest of the world."
-- John Muir

The tex equivalent is a \ (backslash with a space after it)

Jim

···

On Wed, 21 Jul 2004, Carla A. Ng wrote:

Anyone out there know a command to manually add a space? Is there
something equivalent to \t or \n?

I am sure there is better solutions, but
title(r"$\delta^{15}N \ and \ Trophic \ Level \ for \ %s \ Food \
Web$"%name)
should already be close to what you want: "\ " add a space and the name
is inserted in the classic python way (replace %s in the string by the
string appearing after the % operator...)
Now I wonder if mixing Tex math expression and normal text expression is
possible, something like:
title(r"$\delta^{15}N$ and Trophic Level for %s Food Web"%name)
Advantange would be to use classic font for non-math part, as done in
Tex...
This does not seems to work in matplotlib 0.54.2, but maybe in 0.60.2?
Or in future version? :wink:

Regards,

Greg.