You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Drastic decrease in performance for matplotlib plotting #297
I found the cause of the bug, shown in a couple of message down. Merging the fix PR and closing this issue.
I am experience a drastic decrease in performance when plotting shapes, observed on the Visium HD notebook.
The notebook from the docs (which is using either the latest release code but maybe also some earlier code), took ~10 seconds to make this plot, for ~90000 shapes:
With the latest main, using method='matplotlib' didn't finish in one hour. Here is the code
I have therefore used datashader, which took ~40 seconds (still worse than the original code, but I reported this in a separate issue #296). Here I would put the focus on finding out why matplotlib based plotting got so slow.
A final note, I am setting up a codspeed GitHub Action so in the future benchmarks will be automatically run at each commit; I am working on this in a draft PR #295.
Activity
LucaMarconato commentedon Jul 13, 2024
Here is the viz from a
.pstatbenchmark file collected by running the test (recorded while executing 'method'='matplotlib')(test available from the PR #295).

LucaMarconato commentedon Jul 13, 2024
It seems that the problem are the calls to
add_collection()fromspatialdata_plot.pl.render._render_shapes()Any comment?
LucaMarconato commentedon Jul 13, 2024
Removing the line
cax = ax.add_collection(_cax)fixes the issue; it was introduced in this PR here: https://github.com/scverse/spatialdata-plot/pull/244/files#diff-eb3d4aa0a6246689774651947ba2b351d639ab0f0585b67de070a3c33f2e92f4.It seems to be just a typo after a copy-paste.