PyQt4 FigureCanvasQTAgg Subclass segfaults with Matplotlib 1.1?

Hey all,

Anyone know what has changed from Maplotlib 1.0.x to 1.1.x that might cause a PyQt4 application to segfault?

Here is the code I’m working on: https://github.com/sunpy/sunpy/blob/master/doc/examples/rgb_composite/rgb_composite.py

It works fine with earlier versions of Matplotlib (0.99 and 1.0.x) but when I try and run the demo with Matplotlib 1.1 I get a segfault.

Any ideas?

Thanks,

Keith

bump

Anyone else encountering this problem?

···

On Tue, Mar 6, 2012 at 4:06 PM, Keith Hughitt <keith.hughitt@…287…> wrote:

Hey all,

Anyone know what has changed from Maplotlib 1.0.x to 1.1.x that might cause a PyQt4 application to segfault?

Here is the code I’m working on: https://github.com/sunpy/sunpy/blob/master/doc/examples/rgb_composite/rgb_composite.py

It works fine with earlier versions of Matplotlib (0.99 and 1.0.x) but when I try and run the demo with Matplotlib 1.1 I get a segfault.

Any ideas?

Thanks,

Keith

Have you tried running with older checkouts on the master branch to
see when the problem was introduced? You can do something like:

git log --oneline --graph lib/matplotlib/backends/backend_qt4.py # or
backend_qt4agg.py

to see what commits were applied to master but not v1.0.x. Try
bisecting the commit history to find the commit that introduced the
problem (which you might want to describe in a little more detail.)

Darren

···

On Mon, Mar 12, 2012 at 10:13 AM, Keith Hughitt <keith.hughitt@...287...> wrote:

*bump*

Anyone else encountering this problem?

On Tue, Mar 6, 2012 at 4:06 PM, Keith Hughitt <keith.hughitt@...287...> > wrote:

Hey all,

Anyone know what has changed from Maplotlib 1.0.x to 1.1.x that might
cause a PyQt4 application to segfault?

Here is the code I'm working
on: https://github.com/sunpy/sunpy/blob/master/doc/examples/rgb_composite/rgb_composite.py

It works fine with earlier versions of Matplotlib (0.99 and 1.0.x) but
when I try and run the demo with Matplotlib 1.1 I get a segfault.

Any ideas?

Thanks,
Keith

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
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-dev2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Thanks for the suggestions, Darren.

I spent some time going through older revisions of Matplotlib (and
Numpy and SciPy) and it turns out that it isn't an issue with
Matplotlib as I originally suspected, but rather how I went out
updated an imshow-based plot. Previously I was attempting to plot an
image first, then set then use the result to create a
FigureCanvasQTAgg instance:

    import matplotlib.pyplot as plt

    figure = plt.figure()
    self.axes = figure.add_subplot(111)
    self.axes.imshow(...)

    self.figure = figure
    FigureCanvasQTAgg.__init__(self, self.figure)

This works in some environments and it happened to work at the time I
originally developed the code, but is not the best way to do things.

A better way is to first instantiate a Figure instance:

    self.figure = Figure()
    self.axes = self.figure.add_subplot(111)
    self.axes.imshow(...)
    FigureCanvasQTAgg.__init__(self, self.figure)

For now this seems to do the trick. If anyone knows of a better way to
do things, please let me know.

Thanks!
Keith

···

On Mon, Mar 12, 2012 at 11:57 AM, Darren Dale <dsdale24@...287...> wrote:

Have you tried running with older checkouts on the master branch to
see when the problem was introduced? You can do something like:

git log --oneline --graph lib/matplotlib/backends/backend_qt4.py # or
backend_qt4agg.py

to see what commits were applied to master but not v1.0.x. Try
bisecting the commit history to find the commit that introduced the
problem (which you might want to describe in a little more detail.)

Darren

On Mon, Mar 12, 2012 at 10:13 AM, Keith Hughitt <keith.hughitt@...287...> wrote:
> *bump*
>
> Anyone else encountering this problem?
>
>
> On Tue, Mar 6, 2012 at 4:06 PM, Keith Hughitt <keith.hughitt@...287...> > > wrote:
>>
>> Hey all,
>>
>> Anyone know what has changed from Maplotlib 1.0.x to 1.1.x that might
>> cause a PyQt4 application to segfault?
>>
>> Here is the code I'm working
>> on: https://github.com/sunpy/sunpy/blob/master/doc/examples/rgb_composite/rgb_composite.py
>>
>> It works fine with earlier versions of Matplotlib (0.99 and 1.0.x) but
>> when I try and run the demo with Matplotlib 1.1 I get a segfault.
>>
>> Any ideas?
>>
>> Thanks,
>> Keith
>>
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> 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-dev2
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> matplotlib-users List Signup and Options
>

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
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-dev2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options