mathtext in labels

Steve Schmerler <elcorto@...361...> writes:

  plot(..., label = r'$x^2 = $' + str(3))

produces labels like $x^2 = $3

I think this is because I try to join a "normal" string and a "raw"
string. Is there a way to do this properly?

The raw-ness is not relevant to the problem; the only thing it does it
prevent special interpretation of backslashes. What is "raw" is the
string literal in your file, not the string value.

You need to keep the dollar signs at the beginning and end. What you
want is the percent-sign operator:

  label = r'$x^2 = %d$' % 3