From b986f60aa6c89f126acf8e6f9ea1513b058ac374 Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Fri, 15 Dec 2023 07:40:53 +0100 Subject: [PATCH] Best-legend-location microoptimization --- lib/matplotlib/legend.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index ba9ee10ef10c..67925b9a99bc 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -981,8 +981,7 @@ def _auto_legend_data(self): elif isinstance(artist, Collection): transform, transOffset, hoffsets, _ = artist._prepare_points() if len(hoffsets): - for offset in transOffset.transform(hoffsets): - offsets.append(offset) + offsets.extend(transOffset.transform(hoffsets)) return bboxes, lines, offsets