SVG backend bug when called with Latex

Hi all,

the following shows a bug in the backend sate handling of mpl:

plot(range(10))
title(r'Foo $x=1$')
savefig('foo.eps') # works fine, as expected.
savefig('foo.svg') # doesn't work, that's OK: not implemented
savefig('foo.eps') # now, this doesn't work anymore. That's the bug.

Basically, when the SVG backend fails to properly generate the file
with latex strings, it fails to resstore something in the backend
state, and MPL ends up 'wedged'. After that point, the only way to
get an EPS plot again seems to be to restart the session.

Cheers,

f

This was a bug where tkagg was switching backends to svg, but not
trapping the error and resetting the backend on failure. so you were
stuck in svg mode. Now we catch the error, switch the backend back to
tkagg, and then reraise.

Fortunately, I had easy access to a platform where mathtext was
installed to test and debug on :slight_smile:

JDH

···

On 5/12/07, Fernando Perez <fperez.net@...149...> wrote:

Hi all,

the following shows a bug in the backend sate handling of mpl:

plot(range(10))
title(r'Foo $x=1$')
savefig('foo.eps') # works fine, as expected.
savefig('foo.svg') # doesn't work, that's OK: not implemented
savefig('foo.eps') # now, this doesn't work anymore. That's the bug.

Basically, when the SVG backend fails to properly generate the file
with latex strings, it fails to resstore something in the backend
state, and MPL ends up 'wedged'. After that point, the only way to
get an EPS plot again seems to be to restart the session.

This was a bug where tkagg was switching backends to svg, but not
trapping the error and resetting the backend on failure. so you were
stuck in svg mode. Now we catch the error, switch the backend back to
tkagg, and then reraise.

Note that I was using WXAgg where I saw it.

Fortunately, I had easy access to a platform where mathtext was
installed to test and debug on :slight_smile:

Glad to help :slight_smile:

Off to the airport...

f

···

On 5/15/07, John Hunter <jdh2358@...149...> wrote:

It looks like this is a problem across many backends, and is best
handled in backend_agg itself. I just made a few changes to agg,
tkagg, wxagg and gtkagg to fix this. If anyone encounters weirdness,
let me know.

JDH

···

On 5/15/07, Fernando Perez <fperez.net@...149...> wrote:

On 5/15/07, John Hunter <jdh2358@...149...> wrote:

> This was a bug where tkagg was switching backends to svg, but not
> trapping the error and resetting the backend on failure. so you were
> stuck in svg mode. Now we catch the error, switch the backend back to
> tkagg, and then reraise.

Note that I was using WXAgg where I saw it.