Skip to content

Commit 9409eb0

Browse files
committed
graphic collections return Graphic instead of CollectionIndexer if sliced with int
1 parent 5425ca7 commit 9409eb0

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fastplotlib/graphics/_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,9 @@ def _reset_index(self):
356356
graphic.collection_index = new_index
357357

358358
def __getitem__(self, key):
359-
if isinstance(key, int):
360-
key = [key]
359+
if isinstance(key, (int, np.integer)):
360+
# single graphic indexed
361+
return self.graphics[key]
361362

362363
if isinstance(key, slice):
363364
key = cleanup_slice(key, upper_bound=len(self))

0 commit comments

Comments
 (0)