@@ -274,22 +274,31 @@ def draw(self, renderer):
274
274
trans = self .get_transforms ()
275
275
facecolors = self .get_facecolor ()
276
276
edgecolors = self .get_edgecolor ()
277
+ do_single_path_optimization = False
277
278
if (len (paths ) == 1 and len (trans ) <= 1 and
278
279
len (facecolors ) == 1 and len (edgecolors ) == 1 and
279
280
len (self ._linewidths ) == 1 and
280
281
self ._linestyles == [(None , None )] and
281
282
len (self ._antialiaseds ) == 1 and len (self ._urls ) == 1 and
282
283
self .get_hatch () is None ):
284
+ if len (trans ):
285
+ combined_transform = (transforms .Affine2D (trans [0 ]) +
286
+ transform )
287
+ else :
288
+ combined_transform = transform
289
+ extents = paths [0 ].get_extents (combined_transform )
290
+ if (extents .width < renderer .width and
291
+ extents .height < renderer .height ):
292
+ do_single_path_optimization = True
293
+
294
+ if do_single_path_optimization :
283
295
gc .set_foreground (tuple (edgecolors [0 ]))
284
296
gc .set_linewidth (self ._linewidths [0 ])
285
297
gc .set_linestyle (self ._linestyles [0 ])
286
298
gc .set_antialiased (self ._antialiaseds [0 ])
287
299
gc .set_url (self ._urls [0 ])
288
- if len (trans ):
289
- transform = (transforms .Affine2D (trans [0 ]) +
290
- transform )
291
300
renderer .draw_markers (
292
- gc , paths [0 ], transform .frozen (),
301
+ gc , paths [0 ], combined_transform .frozen (),
293
302
mpath .Path (offsets ), transOffset , tuple (facecolors [0 ]))
294
303
else :
295
304
renderer .draw_path_collection (
0 commit comments