Title: ENH: make mouse over behavior configurable by tacaswell · Pull Request #4847 · matplotlib/matplotlib · GitHub
Open Graph Title: ENH: make mouse over behavior configurable by tacaswell · Pull Request #4847 · matplotlib/matplotlib
X Title: ENH: make mouse over behavior configurable by tacaswell · Pull Request #4847 · matplotlib/matplotlib
Description: The mouse-over behavior to add a string to the message line
can quickly become too expensive to compute the hit list
in the time between mouse move events (particularly in the nbagg
and qt5agg backends) when the number of artists gets large.
This adds:
a flag on the Axes objects to control if the hitlist should
be computed
an rcparam to control it
@blink1073
import matplotlib.backend_bases as mbb
fig, ax = plt.subplots()
for j in range(150):
ax.plot(j + np.sin(np.arange(0, 5000)))
# fake mouse event
ev = mbb.MouseEvent('motion_notify_event', fig.canvas, 150, 150)
ev.inaxes = ax
ax.mouseover = True
%prun ax.figure.canvas.manager.toolbar.mouse_move(ev)
17104 function calls (16654 primitive calls) in 0.038 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
166 0.017 0.000 0.018 0.000 lines.py:36(segment_hits)
198 0.003 0.000 0.033 0.000 lines.py:384(contains)
229 0.002 0.000 0.002 0.000 {built-in method affine_transform}
198 0.002 0.000 0.003 0.000 path.py:212(_update_values)
323/171 0.001 0.000 0.003 0.000 transforms.py:2352(get_affine)
261/1 0.001 0.000 0.037 0.037 artist.py:333(hitlist)
202 0.001 0.000 0.001 0.000 {method 'reduce' of 'numpy.ufunc' objects}
408 0.001 0.000 0.001 0.000 weakref.py:101(__init__)
396 0.001 0.000 0.002 0.000 numeric.py:2428(seterr)
396 0.001 0.000 0.001 0.000 numeric.py:2524(geterr)
327 0.001 0.000 0.001 0.000 {built-in method array}
198 0.001 0.000 0.004 0.000 path.py:103(__init__)
337 0.000 0.000 0.000 0.000 {built-in method dot}
408 0.000 0.000 0.001 0.000 transforms.py:86(__init__)
198 0.000 0.000 0.007 0.000 transforms.py:1660(transform_path_affine)
353 0.000 0.000 0.002 0.000 transforms.py:1768(__init__)
412 0.000 0.000 0.000 0.000 __init__.py:879(__getitem__)
170 0.000 0.000 0.000 0.000 {built-in method concatenate}
371 0.000 0.000 0.001 0.000 transforms.py:1622(__init__)
364 0.000 0.000 0.000 0.000 {method 'nonzero' of 'numpy.ndarray' objects}
1 0.000 0.000 0.000 0.000 {built-in method showMessage}
219 0.000 0.000 0.002 0.000 transforms.py:1723(transform_affine)
524 0.000 0.000 0.000 0.000 {built-in method isinstance}
408 0.000 0.000 0.000 0.000 weakref.py:255(update)
396 0.000 0.000 0.000 0.000 {built-in method seterrobj}
248 0.000 0.000 0.001 0.000 numeric.py:394(asarray)
198 0.000 0.000 0.000 0.000 transforms.py:2662(_revalidate)
198 0.000 0.000 0.003 0.000 transforms.py:2687(get_transformed_path_and_affine)
1246 0.000 0.000 0.000 0.000 {built-in method len}
23 0.000 0.000 0.002 0.000 text.py:917(get_window_extent)
39 0.000 0.000 0.002 0.000 text.py:251(contains)
16 0.000 0.000 0.000 0.000 transforms.py:692(translated)
332 0.000 0.000 0.000 0.000 {method 'ravel' of 'numpy.ndarray' objects}
198 0.000 0.000 0.003 0.000 transforms.py:2703(get_affine)
792 0.000 0.000 0.000 0.000 {built-in method geterrobj}
437 0.000 0.000 0.000 0.000 transforms.py:1813(get_matrix)
167 0.000 0.000 0.000 0.000 transforms.py:2527(get_matrix)
400 0.000 0.000 0.000 0.000 path.py:221(vertices)
202 0.000 0.000 0.001 0.000 {method 'all' of 'numpy.ndarray' objects}
202 0.000 0.000 0.001 0.000 _methods.py:40(_all)
186/170 0.000 0.000 0.000 0.000 transforms.py:2313(_get_is_affine)
25 0.000 0.000 0.000 0.000 transforms.py:401(_get_bounds)
198 0.000 0.000 0.007 0.000 transforms.py:1656(transform_path)
25 0.000 0.000 0.000 0.000 transforms.py:779(__init__)
162 0.000 0.000 0.000 0.000 transforms.py:2209(get_matrix)
16 0.000 0.000 0.000 0.000 font_manager.py:786(get_size_in_points)
198 0.000 0.000 0.000 0.000 core.py:5776(isMaskedArray)
198 0.000 0.000 0.000 0.000 lines.py:663(_get_transformed_path)
4 0.000 0.000 0.000 0.000 linalg.py:455(inv)
39 0.000 0.000 0.000 0.000 text.py:880(get_position)
21 0.000 0.000 0.001 0.000 transforms.py:1292(transform)
42 0.000 0.000 0.000 0.000 weakref.py:149(__setitem__)
2 0.000 0.000 0.000 0.000 patches.py:653(_update_patch_transform)
16 0.000 0.000 0.000 0.000 font_manager.py:701(__hash__)
16 0.000 0.000 0.000 0.000 text.py:886(get_prop_tup)
49 0.000 0.000 0.000 0.000 {method 'copy' of 'numpy.ndarray' objects}
16 0.000 0.000 0.000 0.000 text.py:327(_get_layout)
242 0.000 0.000 0.000 0.000 artist.py:351(get_children)
202 0.000 0.000 0.000 0.000 path.py:235(codes)
198 0.000 0.000 0.000 0.000 cbook.py:753(is_numlike)
21 0.000 0.000 0.001 0.000 transforms.py:1388(transform_point)
214 0.000 0.000 0.000 0.000 figure.py:399(_get_dpi)
22 0.000 0.000 0.000 0.000 transforms.py:162(set_children)
21 0.000 0.000 0.000 0.000 transforms.py:2328(transform_affine)
4 0.000 0.000 0.000 0.000 {built-in method point_in_path}
2 0.000 0.000 0.001 0.000 patches.py:673(contains)
vs
ax.mouseover = False
%prun ax.figure.canvas.manager.toolbar.mouse_move(ev)
13 function calls in 0.000 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 {method 'emit' of 'PyQt5.QtCore.pyqtBoundSignal' objects}
1 0.000 0.000 0.000 0.000 {built-in method exec}
1 0.000 0.000 0.000 0.000 {built-in method statusBar}
1 0.000 0.000 0.000 0.000 backend_bases.py:2805(mouse_move)
1 0.000 0.000 0.000 0.000
Open Graph Description: The mouse-over behavior to add a string to the message line can quickly become too expensive to compute the hit list in the time between mouse move events (particularly in the nbagg and qt5agg back...
X Description: The mouse-over behavior to add a string to the message line can quickly become too expensive to compute the hit list in the time between mouse move events (particularly in the nbagg and qt5agg back...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/4847
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2f44fb13-7b47-c3ea-5ade-c17f0b8359d7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9308:152AB4:E35D3:12CBCA:6A52DEEA |
| html-safe-nonce | 584ee8bc5978630364eedfc4aebb2cf2f827c81b560c5190b074de8f5a8b5d4f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzA4OjE1MkFCNDpFMzVEMzoxMkNCQ0E6NkE1MkRFRUEiLCJ2aXNpdG9yX2lkIjoiMjUzNTQwNjE3Mzk5NTMyNzIxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c76761a5697174ebb7204c55aac78cb5a55a9a9d5b54f091e7efdc19905229bd |
| hovercard-subject-tag | pull_request:41395202 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/4847/files |
| twitter:image | https://avatars.githubusercontent.com/u/199813?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/199813?s=400&v=4 |
| og:image:alt | The mouse-over behavior to add a string to the message line can quickly become too expensive to compute the hit list in the time between mouse move events (particularly in the nbagg and qt5agg back... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width