[Matplotlib-users] Adding artists without changing the underlying Axes etc.

Andrew Athan aathan_matplotlib at memeplex.com
Sat Aug 15 16:24:58 EDT 2020


I have implemented speedups based on the copy_from_bbox() and 
restore_region() APIs (i.e., blit APIs) in conjunction with an Agg 
canvas (my destination is actually a file, not screen).

I create a bar() plot, then grab the plot with copy_from_bbox(), then I 
create Line2D() artists and add them using ax.add_line(). Following 
this, I remove the artists, restore_region() and wash, rinse, repeat().

I'm finding that the process can lead to creep in data to screen 
transforms, which I guess must be due to bounding box changes when I add 
lines that may exceed the bbox. That's my theory.

Is there a mechanism or recommended methodology to tell artists (and/or 
the axes they are being added to) not to recalculate anything, so that 
the underlying plot remains unchanged by the add()?

A.


More information about the Matplotlib-users mailing list