ChartMPL redraws too readily
See original GitHub issueDescribe the bug, what’s wrong, and what you expected.
in ChartMPL, a callback to self._redraw is connected to the canvas on draw_event
https://github.com/pyvista/pyvista/blob/fb108591f941f7452c05905da3fb9c13a54f92dc/pyvista/plotting/charts.py#L4184 which grabs the canvas buffer and makes a new vtkImageData object.
The problem is that the draw_event
happens rapidly, even just by moving the mouse across the plot window without any updates to the plot dimensions or underlying plot image or data. This causes performance issues.
Ideally, the _redraw method shouldn’t be called so often, or some caching could be used to speed this up. Matplotlib is a very great library to rely upon for plotting but I wouldn’t expect the canvas to be redrawn so often.
Steps to reproduce the bug.
Insert code here
System Information
--------------------------------------------------------------------------------
Date: Sat Jul 02 20:15:06 2022 PDT
OS : Darwin
CPU(s) : 8
Machine : x86_64
Architecture : 64bit
RAM : 16.0 GiB
Environment : IPython
File system : apfs
GPU Vendor : ATI Technologies Inc.
GPU Renderer : AMD Radeon Pro 560 OpenGL Engine
GPU Version : 4.1 ATI-4.6.21
Python 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:43:32)
[Clang 12.0.1 ]
pyvista : 0.34.0
vtk : 9.1.0
numpy : 1.21.6
imageio : 2.16.1
appdirs : 1.4.4
scooby : 0.5.12
matplotlib : 3.5.2
pyvistaqt : 0.9.0
IPython : 8.3.0
colorcet : 3.0.0
ipyvtklink : 0.2.2
scipy : 1.8.0
tqdm : 4.63.0
meshio : 5.3.4
--------------------------------------------------------------------------------
Screenshots
No response
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Source code for pyvista.plotting.charts
"Very large"] >>> chart.show() Revert back to automatic tick placement. > ... interface for vtkChart, vtkChartBox, vtkChartPie and ChartMPL instances.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dcbr try clicking and dragging across the plotter window. I am developing a little app for my research which uses a multiplot so the following updated code example should illustrate the issue:
I agree the call to
_redraw
is needed when the canvas is updated, but currently the redraw method is being called without any significant or real state change. Maybe some timeout based cache could be used or if there is a more specific event to use (like if the canvas data changes or if the window is resized… etc).Exactly, I verified the dynamic updates still work by running the chart_overlays example.