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
Drawing of plots with multiple matplotlib.Text instances is so slow as to be unusable for some applications, such as realtime multiple sequence alignment rendering/viewing (see attachment for a pylab example, resize plot window to see effect).
Some layman's thoughts:
Would it be possible to speed things up by implementing some kind of Text Collection?
Is antialiasing involved? An option to turn it off would be nice in that case.
SourceForge Comments
On Thu Sep 6 16:07:54 2007, mdboom wrote:
Logged In: YES
user_id=119312
Originator: NO
It appears that the text is re-rendered to a newly allocated buffer each time the text is drawn. Perhaps some caching of text elements would help.
(Mostly just making a note of it for someone else to work this through, or until I have the time.)
SourceForge History
On Wed Mar 21 08:03:30 2007, by yohell: File Added: 221568: test.py
Rendering text with the Agg backend is slow because it assumes the text may be rotated, which requires an affine transformation and filtering at each pixel. I have a faster text blitting implementation (for non-rotated text only) on my 347_fast_text branch. This change provides about a 20% speedup on this example. Unfortunately, this causes a lot of the regression tests to now fail since the text is crisper (and theoretically more correct). I will need to wade through the regression test results and update baseline images before merging this.
The need for a TextCollection remains, though from profiling, it's not clear that the lack of one is the bottleneck here.
@mdboom: Seems like a 20% speedup & crisper text are worthwhile pursuits. Do you have any update on this? Are you considering making a PR out of the change?
Activity
mdboom commentedon Jun 21, 2011
This is the OP's attachment:
butterw commentedon Jun 21, 2011
+1 in favor of adding a TextCollection class to matplotlib
mdboom commentedon Jun 22, 2011
There's really two problems here:
Rendering text with the Agg backend is slow because it assumes the text may be rotated, which requires an affine transformation and filtering at each pixel. I have a faster text blitting implementation (for non-rotated text only) on my 347_fast_text branch. This change provides about a 20% speedup on this example. Unfortunately, this causes a lot of the regression tests to now fail since the text is crisper (and theoretically more correct). I will need to wade through the regression test results and update baseline images before merging this.
The need for a TextCollection remains, though from profiling, it's not clear that the lack of one is the bottleneck here.
pelson commentedon Jun 30, 2012
@mdboom: Seems like a 20% speedup & crisper text are worthwhile pursuits. Do you have any update on this? Are you considering making a PR out of the change?
Tillsten commentedon Sep 30, 2015
This would be really nice. After doing some profiling text rendering and complicated tick handling are main reasons for mpl slowness.
Fix matplotlib#347: Faster text rendering in Agg
Fix matplotlib#347: Faster text rendering in Agg
Merge pull request #5361 from mdboom/fast-text
Merge pull request #5361 from mdboom/fast-text