Re: [Matplotlib-users] Error when saving as PDF using $\alpha$ and 'text.usetex':True

2012-03-09 Thread Alejandro Weinstein
On Thu, Mar 8, 2012 at 12:45 PM, Jouni K. Seppänen j...@iki.fi wrote:
 Alejandro Weinstein alejandro.weinst...@gmail.com writes:

 TypeError: unicode argument expected, got 'str'
 I am using MPL verion 1.2.x (built from commit 396a6446).

 That reminds me of a problem fixed in commit 680edf7, so could you
 either try cherry-picking that commit or updating to a later revision?
 Your test case doesn't produce an error on a recent-ish master.

You're right. Just updated to the last version and the problem is gone.

Thanks!

Alejandro.

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Error when saving as PDF using $\alpha$ and 'text.usetex':True

2012-03-08 Thread Jouni K . Seppänen
Alejandro Weinstein alejandro.weinst...@gmail.com writes:

 TypeError: unicode argument expected, got 'str'
 I am using MPL verion 1.2.x (built from commit 396a6446).

That reminds me of a problem fixed in commit 680edf7, so could you
either try cherry-picking that commit or updating to a later revision?
Your test case doesn't produce an error on a recent-ish master.

-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Error when saving as PDF using $\alpha$ and 'text.usetex':True

2012-03-06 Thread Alejandro Weinstein
Hi:

I am getting an error when I save a figure as PDF with a particular
configuration and when I use a greek latex leter (say $\alpha$) as a
ylabel. The following code illustrates the problem.

###
import matplotlib.pyplot as plt
import matplotlib as mpl

params = {
'text.usetex' : True,
'font.family': 'serif',
'font.serif' : ['Times'],
}
mpl.rcParams.update(params)

plt.figure()
plt.plot([1,2,3])
plt.ylabel(r'$\alpha$')
plt.savefig('f1.pdf')
###

When I run it I get

Traceback (most recent call last):
  File multipage_pdf.py, line 14, in module
plt.savefig('f1.pdf')
  File /usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py,
line 472, in savefig
return fig.savefig(*args, **kwargs)
  File /usr/local/lib/python2.7/dist-packages/matplotlib/figure.py,
line 1173, in savefig
self.canvas.print_figure(*args, **kwargs)
  File /usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py,
line 2027, in print_figure
**kwargs)
  File /usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py,
line 1799, in print_pdf
return pdf.print_pdf(*args, **kwargs)
  File 
/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py,
line 2187, in print_pdf
file.close()
  File 
/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py,
line 470, in close
self.writeFonts()
  File 
/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py,
line 557, in writeFonts
fonts[Fx] = self.embedTeXFont(filename, self.dviFontInfo[filename])
  File 
/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py,
line 622, in embedTeXFont
t1font = t1font.transform(fontinfo.effects)
  File /usr/local/lib/python2.7/dist-packages/matplotlib/type1font.py,
line 301, in transform
buffer.write(value)
TypeError: unicode argument expected, got 'str'


Note that with any of the following variations the code works as expected:

- If I use plt.ylabel(r'$x_2$') instead of plt.ylabel(r'$\alpha$).
- If I save as PNG instead of PDF.
- Use the default configuration (comment the mpl.rcParams.update(params) line).

I am using MPL verion 1.2.x (built from commit 396a6446).

Am I doing something wrong? Any idea how to solve it?

Alejandro.

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users