Merge pull request #1239 from j9ac9k/PR-343-update

PlotItem doesn't add item if already there
This commit is contained in:
Ogi Moore 2020-06-08 22:18:15 -07:00 committed by GitHub
commit 0dcd79bbc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import sys
import warnings
import weakref
import numpy as np
import os
@ -514,6 +515,9 @@ class PlotItem(GraphicsWidget):
If the item has plot data (PlotDataItem, PlotCurveItem, ScatterPlotItem), it may
be included in analysis performed by the PlotItem.
"""
if item in self.items:
warnings.warn('Item already added to PlotItem, ignoring.')
return
self.items.append(item)
vbargs = {}
if 'ignoreBounds' in kargs: