Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Popover over plot is very slow #12010

Closed
Labels
Milestone
@akhilman

Description

@akhilman

Bug report

Bug summary

Gtk3 overlay widgets like popover is very slow when they placed over plot.

Code for reproduction

importgi# isort:skipgi.require_version('Gtk','3.0')# NOQA: E402fromgi.repositoryimportGtk# isort:skipimportnumpyasnpfrommatplotlib.backends.backend_gtk3aggimport \FigureCanvasGTK3AggasFigureCanvasfrommatplotlib.figureimportFigurewin=Gtk.Window()box=Gtk.Box(orientation=Gtk.Orientation.VERTICAL)button=Gtk.Button(label='Push me')box.pack_start(button,False,True,0)popover=Gtk.Popover(relative_to=button)popbox=Gtk.Box(orientation=Gtk.Orientation.VERTICAL)pixbuf=Gtk.IconTheme.get_default().load_icon('gtk-about',256,0)icon=Gtk.Image.new_from_pixbuf(pixbuf)popbox.pack_start(icon,False,True,0)label=Gtk.Label('Popover should be slow')popbox.pack_start(label,False,True,0)popover.add(popbox)popbox.show_all()popbox.set_margin_top(16)popbox.set_margin_bottom(16)popbox.set_margin_left(16)popbox.set_margin_right(16)button.connect('clicked',lambdaw:popover.popup())fig=Figure()ax=fig.add_subplot(111)canvas=FigureCanvas(fig)canvas.set_size_request(640,489)box.pack_start(canvas,True,True,0)arr=np.random.random((2,2000,2000))ax.scatter(arr[0][0],arr[0][1],arr[1].flatten()*40)win.add(box)win.connect('destroy',Gtk.main_quit)win.show_all()Gtk.main()

Actual outcome

Click to"push me" button to show popover, animation will be slow.
cProfile shows that most of time python spends in redrawing entire plot during animation.

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)                                                                             43   30.353    0.706   30.359    0.706 collections.py:883(set_sizes)                                                                          1   11.329   11.329   50.730   50.730 Gtk.py:1608(main)                                                                                     42    4.675    0.111    5.254    0.125 {method 'draw_path_collection' of 'matplotlib.backends._backend_agg.RendererAgg' objects}              1    0.245    0.245    0.245    0.245 {method 'random_sample' of 'mtrand.RandomState' objects}                                           90130    0.155    0.000    0.155    0.000 path.py:208(vertices)                                                                              87356    0.155    0.000    0.155    0.000 path.py:241(simplify_threshold)                                                                35583/26326    0.155    0.000    0.295    0.000 artist.py:230(stale)                                                                             88197    0.150    0.000    0.150    0.000 path.py:222(codes)                                                                                 88616    0.145    0.000    0.145    0.000 path.py:260(should_simplify)

Expected outcome

Plot should be cached somehow and won't be redrawn in this case.

Matplotlib version

  • Operating system: Debian Sid
  • Matplotlib version: 2.2.3
  • Matplotlib backend: Gtk3Agg and Gtk3Cairo
  • Python version: 3.6.6
  • Gtk: 3.22,30

Matplotlib installed in virtual environment with pip.

I would like to fix this issue and make PR. Please point me any direction how this problem can be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp