Python interactive window drops fps when creating many plots - SVG rendering is slow
See original GitHub issueNot sure how hard it is to do anything about this but I noticed that if the Python interactive window contains lots of plots already (above maybe 30), adding new ones brings the frame rate down quite significantly. Above around 60 plots, it’s at less than 1 fps and makes all of VS Code become unresponsive. Once the plots are done, VS Code (including the interactive window) returns to normal.
Here’s some example code to reproduce the issue.
#%%
import matplotlib.pyplot as plt
import numpy as np
for i in range(100):
plt.plot()
N = 50
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
area = (30 * np.random.rand(N)) ** 2 # 0 to 15 point radii
plt.title(f"plot #{i + 1}")
plt.scatter(x, y, s=area, c=colors, alpha=0.5)
plt.show()
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Python interactive window drops fps when creating many plots ...
Possible solution - Generate PNGs along with the SVG, but only display the PNG in the history window. When the plot viewer opens,...
Read more >why is plotting with Matplotlib so slow? - Stack Overflow
First off, (though this won't change the performance at all) consider cleaning up your code, similar to this: import matplotlib.pyplot as ...
Read more >Improving SVG Runtime Performance - CodePen
Receiving and decoding data from the network takes CPU. The less of that, the more cycles left over for rendering. Plus, parse time...
Read more >VisPy: Harnessing The GPU For Fast, High-Level ... - HAL-Inria
VisPy leverages the GPU to provide fast, interactive, and beautiful visualizations in a high-level API. Here we introduce the main features, ...
Read more >VisPy: Harnessing The GPU For Fast, High-Level Visualization
VisPy lever- ages the GPU to provide fast, interactive, and beautiful visualizations in a high- level API. Here we introduce the main features,...
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
@DonJayamanne yes we want to do that too. Something like this looks promising: https://github.com/twobin/react-lazyload
However, SVG is a lot slower than PNG. We can fix jupyter to generate both.
@DavidKutu my fix for microsoft/vscode-jupyter#3233 should fix this too.