@@ -211,7 +211,11 @@ class Figure(Artist):
211211
212212 *figurePatch*
213213 a :class:`matplotlib.patches.Rectangle` instance
214-
214+ *suppressComposite
215+ for multiple figure images, the figure will make composite
216+ images depending on the renderer option_image_nocomposite
217+ function. If suppressComposite is True|False, this will
218+ override the renderer
215219 """
216220
217221 def __str__ (self ):
@@ -278,7 +282,6 @@ def __init__(self,
278282 self ._axstack = Stack () # maintain the current axes
279283 self .axes = []
280284 self .clf ()
281-
282285 self ._cachedRenderer = None
283286
284287 def _get_dpi (self ):
@@ -328,6 +331,7 @@ def autofmt_xdate(self, bottom=0.2, rotation=30, ha='right'):
328331 def get_children (self ):
329332 'get a list of artists contained in the figure'
330333 children = [self .figurePatch ]
334+ children .extend (self .artists )
331335 children .extend (self .axes )
332336 children .extend (self .lines )
333337 children .extend (self .patches )
@@ -755,7 +759,7 @@ def clf(self):
755759 """
756760 Clear the figure
757761 """
758-
762+ self . suppressComposite = None
759763 self .callbacks = cbook .CallbackRegistry (('dpi_changed' , ))
760764
761765 for ax in tuple (self .axes ): # Iterate over the copy.
@@ -767,6 +771,7 @@ def clf(self):
767771 toolbar .update ()
768772 self ._axstack .clear ()
769773 self ._seen = {}
774+ self .artists = []
770775 self .lines = []
771776 self .patches = []
772777 self .texts = []
@@ -791,16 +796,23 @@ def draw(self, renderer):
791796
792797 if self .frameon : self .figurePatch .draw (renderer )
793798
799+ # todo: respect zorder
794800 for p in self .patches : p .draw (renderer )
795801 for l in self .lines : l .draw (renderer )
796-
797- if len (self .images )<= 1 or renderer .option_image_nocomposite () or not allequal ([im .origin for im in self .images ]):
802+ for a in self .artists : a .draw (renderer )
803+
804+ # override the renderer default if self.suppressComposite
805+ # is not None
806+ composite = renderer .option_image_nocomposite ()
807+ if self .suppressComposite is not None :
808+ composite = self .suppressComposite
809+
810+ if len (self .images )<= 1 or composite or not allequal ([im .origin for im in self .images ]):
798811 for im in self .images :
799812 im .draw (renderer )
800813 else :
801814 # make a composite image blending alpha
802815 # list of (_image.Image, ox, oy)
803-
804816 mag = renderer .get_image_magnification ()
805817 ims = [(im .make_image (mag ), im .ox * mag , im .oy * mag )
806818 for im in self .images ]
0 commit comments