8000 Segfault when blitting multiple subplots with the gtk3agg backend · Issue #2810 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Segfault when blitting multiple subplots with the gtk3agg backend #2810
Closed
@timovwb

Description

@timovwb

I'm running latest master of matplotlib to enable animations with the Agg backend through cairocffi, but am having issues with multiple subplots.

Here is some modified code from the examples to show the issue:

# Modified example from http://matplotlib.org/examples/animation/simple_anim.html
import numpy as np
import matplotlib as mpl
import matplotlib.animation as animation
from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg as FigureCanvas

from gi.repository import Gtk

class TestWindow(Gtk.Window):
    def __init__(self):
        Gtk.Window.__init__(self)
        self.resize(600, 400)

        figure = mpl.figure.Figure()
        canvas = FigureCanvas(figure)
        self.add(canvas)
        self.show_all()

        x = np.arange(0, 2*np.pi, 0.01)

        ax1 = figure.add_subplot(121)
        line1, = ax1.plot(x, np.sin(x))

        ax2 = figure.add_subplot(122)
        line2, = ax2.plot(x, np.sin(x))

        def animate(i):
            line1.set_ydata(np.sin(x+i/10.0))
            line2.set_ydata(np.sin(x+i/10.0))
            return line1,# line2

        def init():
            line1.set_ydata(np.ma.array(x, mask=True))
            line2.set_ydata(np.ma.array(x, mask=True))
            return line1,# line2

        self.ani = animation.FuncAnimation(figure, animate, np.arange(1, 200), init_func=init,
                                           interval=25, blit=True)

if __name__ == "__main__":
    win = TestWindow()
    win.connect("delete-event", Gtk.main_quit)
    Gtk.main()

This works until the init() and animate() functions return more than one line (uncomment the return values to checck).
I could trace the call back to FigureCanvasGTK3Agg.blit() in backend_gtk3agg.py. Line 90 is the last one called and throws a segmentation fault.

This happens on Ubuntu 12.04, 13.10 and 14.04. Both with Python 2 and Python 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0