tex rendering broken?

I am having trouble executing the example for typesetting labels with
latex from http://matplotlib.org/users/usetex.html. Copying the standard
example, tex_demo.py, to a file and executing it gives the following
output:

Traceback (most recent call last):
  File "scratch.py", line 21, in <module>
    plt.savefig('tex_demo')
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 561, in
savefig
    return fig.savefig(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1421,
in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line
2220, in print_figure
    **kwargs)
  File
"/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line
505, in print_png
    FigureCanvasAgg.draw(self)
  File
"/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line
451, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1034,
in draw
    func(*args)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 2086, in
draw
    a.draw(renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1105, in
draw
    self.label.draw(renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/text.py", line 594, in
draw
    self._fontproperties, angle, mtext=self)
  File
"/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line
241, in draw_tex
    self._renderer.draw_text_image(Z, x, y, angle, gc)
OverflowError: cannot convert float infinity to integer

My system is

Linux mwlaptop 3.16.0-24-generic #32-Ubuntu SMP Tue Oct 28 13:07:32 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux

My matplotlib version is 1.3.1, and I am using standard packages from my
Ubuntu 14.10 distribution.

I just installed matplotlib 1.4.2 via pip, and executing the file
matplotlib-1.4.2/examples/pylab_examples/tex_demo.py from the source
tarball gives the same error:

Traceback (most recent call last):
  File "matplotlib-1.4.2/examples/pylab_examples/tex_demo.py", line 29,
in <module>
    plt.savefig('tex_demo')
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py",
line 577, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py",
line 1470, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py",
line 2194, in print_figure
    **kwargs)
  File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3agg.py", line 97, in print_png
    return agg.print_png(filename, *args, **kwargs)
  File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 521, in print_png
    FigureCanvasAgg.draw(self)
  File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 469, in draw
    self.figure.draw(self.renderer)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py",
line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py",
line 1079, in draw
    func(*args)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py",
line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File
"/usr/local/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line
2092, in draw
    a.draw(renderer)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py",
line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/axis.py", line
1128, in draw
    self.label.draw(renderer)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/artist.py",
line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/text.py", line
581, in draw
    self._fontproperties, angle, mtext=mtext)
  File
"/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 259, in draw_tex
    self._renderer.draw_text_image(Z, x, y, angle, gc)
OverflowError: cannot convert float infinity to integer

System information
Linux mwlaptop 3.16.0-24-generic #32-Ubuntu SMP Tue Oct 28 13:07:32 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux

I just downgraded to matplotlib 1.1.1 and now everything works. Looks
like a regression to me.

···

On Fri, 2014-10-31 at 15:53 +0000, Martin Wiebusch wrote:

I am having trouble executing the example for typesetting labels with
latex from http://matplotlib.org/users/usetex.html. Copying the standard
example, tex_demo.py, to a file and executing it gives the following
output:

Traceback (most recent call last):
  File "scratch.py", line 21, in <module>
    plt.savefig('tex_demo')
  File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 561, in
savefig
    return fig.savefig(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1421,
in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line
2220, in print_figure
    **kwargs)
  File
"/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line
505, in print_png
    FigureCanvasAgg.draw(self)
  File
"/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line
451, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1034,
in draw
    func(*args)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 2086, in
draw
    a.draw(renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/axis.py", line 1105, in
draw
    self.label.draw(renderer)
  File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55, in
draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/matplotlib/text.py", line 594, in
draw
    self._fontproperties, angle, mtext=self)
  File
"/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py", line
241, in draw_tex
    self._renderer.draw_text_image(Z, x, y, angle, gc)
OverflowError: cannot convert float infinity to integer

My system is

Linux mwlaptop 3.16.0-24-generic #32-Ubuntu SMP Tue Oct 28 13:07:32 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux

My matplotlib version is 1.3.1, and I am using standard packages from my
Ubuntu 14.10 distribution.