Maxim wrote:
> Hi all,
>
> I haven't figured out how to do this one. I'm trying the following:
>
> A=plot(sin,-2,2)
> A.axes_labels(['Valeur','Échantillon'])
> A
>
> The 'É' is shown as an empty block. [...]
Hi Maxim,
The only solution I've found is to direct Sage's matplotlib to process
plot text with LaTeX:
#!/usr/bin/env sage-python
# -*- coding: utf-8 -*-
from sage.all import *
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
plt = plot(sin, -pi, pi)
plt.axes_labels([ r'Valeur', r"\'{E}chantillon" ])
plt.show()
Interestingly enough, the following does work with the Enthought
Python Distribution, but *only* if the `coding: utf-8' line is
included (and LaTeX is not handling plot text):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from numpy import linspace, sin
t = linspace(-2, 2, endpoint=True)
plt.plot(t, sin(t))
plt.xlabel('Valeur')
plt.ylabel(u'Échantillon')
plt.show()
This even works with LaTeX processing when EPD's `matplotlibrc'
configuration file contains `text.latex.unicode = True'.
Hope this helps.
Michael
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org