def addCurve(self,plot,name='',**kwargs):
"""
Add a new curve to a 2D plot
.. tabularcolumns:: |p{3cm}|p{11cm}|
=============== ============================================================================================
**Arguments**
=============== ============================================================================================
plot QPlotWidget created using :func:`add2DPlot`
name something to call this trace. Shown in the legend too
=============== ============================================================================================
:return: pyqtgraph.PlotDataItem
"""
#if(len(name)):curve = pg.PlotDataItem(name=name)
curve = pg.PlotCurveItem(name = name,**kwargs)
plot.addItem(curve)
if self.properties['colorScheme']=='white':
curve.setPen(kwargs.get('pen',{'color':self.white_trace_colors[len(self.plots2D[plot])],'width':1}))
elif self.properties['colorScheme']=='black':
curve.setPen(kwargs.get('pen',{'color':self.black_trace_colors[len(self.plots2D[plot])],'width':1}))
#print (self.black_trace_colors[len(self.plots2D[plot])] , len(self.plots2D[plot]) )
self.plots2D[plot].append(curve)
return curve
评论列表
文章目录