TeX $\times$ symbol not working in matplotlib?
gwhite
gwhite at ti.com
Fri Apr 18 19:14:51 EDT 2014
On Friday, April 18, 2014 10:04:17 AM UTC-7, Peter Otten wrote:
> gwhite wrote:
>
> > plt.title(' '.join([r'$\mathrm{poles}$', r'$(\times)$',\
> > r'$\mathrm{\&}$', r'$\mathrm{zeros}$',
> > r'$(\circ)$', r'$\mathrm{of}$',\
> > r'$T(s)T(-s)$']), fontsize=16)
>
> Note that adjacent string literals on the same line or inside parentheses
> are automatically concatenated by the compiler. So you may write the above
> as
>
> plt.title(
> r'$\mathrm{poles}$ $(\times)$ '
> r'$\mathrm{\&}$ $\mathrm{zeros}$ '
> r'$(\circ)$ $\mathrm{of}$ $T(s)T(-s)$',
> fontsize=16)
>
> Even if you leave everything else as is you don't need any backslashes at
> the end of the line.
Well even if it had been right, I omitted one (backslash). I'm such a newb/hack. lol. No animals were harmed.
Yeah, I have noticed that they don't seem to be needed, but I think I remember reading "someplace-somewhere" that a backslash means a line continuation, and perhaps I saw some author put them in. So I did it out of trying to be "strict."
I'm not sure when a backslash continuation might be needed, or if that requirement has been designed out of Python.
Anyway, thanks to all for the notes!
More information about the Python-list
mailing list