Description
In working out a simpler version of #4010, I managed to isolate a different issue (at least, externally). In ObsPy, there is a CatchOutput
context manager that is used by tests to hide output from scripts that are being tested. It redirects stdout
and stderr
to files. With matplotlib 1.3.1, plots turned out fine using this approach.
With matplotlib 1.4.2, something gets messed up somewhere and text is no longer placed correctly.
I have put together a self-contained example including the context manager. It saves what should be the same image twice as x1.png
and x2.png
, but the second one appears as above. Some things to note:
- It works correctly with the
TkAgg
backend instead of theAgg
backend. - It works correctly if both plots are within the same
CatchOutput
context. - Quizzically, there are several
CatchOutput
contexts in the ObsPy tests, but only one pair seem to trigger the bug. Yet this example seems to always trigger the problem and it's much simpler. - A bisect points to f4adec7
Now, superficially, the CatchOutput
context makes sense to me, and though it is a bit of black magic, it did seem to work alright against matplotlib 1.3.1.