本文整理汇总了Python中PyQt4.Qwt5.QwtPlot.replot方法的典型用法代码示例。如果您正苦于以下问题:Python QwtPlot.replot方法的具体用法?Python QwtPlot.replot怎么用?Python QwtPlot.replot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qwt5.QwtPlot
的用法示例。
在下文中一共展示了QwtPlot.replot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QwtPlot
# 需要导入模块: from PyQt4.Qwt5 import QwtPlot [as 别名]
# 或者: from PyQt4.Qwt5.QwtPlot import replot [as 别名]
app = QtGui.QApplication(sys.argv)
p = QwtPlot()
curve = QwtPlotCurve("Segon i tal")
fn = resDir + '/' + data
f = file(fn)
v = pickle.load(f)
y = v
x = range(len(y))
curve.setData(x, y)
curve.attach(p)
p.replot()
p.show()
sys.exit(app.exec_())
示例2: ImageControlDialog
# 需要导入模块: from PyQt4.Qwt5 import QwtPlot [as 别名]
# 或者: from PyQt4.Qwt5.QwtPlot import replot [as 别名]
#.........这里部分代码省略.........
if hmin is None:
hmin, hmax = hmin0, hmax0
# downsample to low-res histogram
self._hist = self._hist_hires.reshape((self.NumHistBins, self.NumHistBinsHi / self.NumHistBins)).sum(1)
else:
# zoomed-in low-res histogram
# bracket limits at subset range
hmin, hmax = max(hmin, dmin), min(hmax, dmax)
if hmin >= hmax:
hmax = hmin + 1
dprint(1, "computing histogram for", self._subset.shape, self._subset.dtype, hmin, hmax)
self._hist = measurements.histogram(subset, hmin, hmax, self.NumHistBins, labels=mask,
index=None if mask is None else False)
dprint(1, "histogram computed")
# compute bins
self._itf_bins = hmin + (hmax - hmin) * (numpy.arange(self.NumItfBins)) / (float(self.NumItfBins) - 1)
self._hist_bins = hmin + (hmax - hmin) * (numpy.arange(self.NumHistBins) + 0.5) / float(self.NumHistBins)
# histogram range and position of peak
self._hist_range = hmin, hmax
self._hist_min, self._hist_max, self._hist_imin, self._hist_imax = measurements.extrema(self._hist)
self._hist_peak = self._hist_bins[self._hist_imax]
# set controls accordingly
if dmin >= dmax:
dmax = dmin + 1
zoom = math.log10((dmax - dmin) / (hmax - hmin))
self._whistzoom.setValue(zoom)
self._whistunzoom.setEnabled(zoom > 0)
self._whistzoomout.setEnabled(zoom > 0)
# reset scales
self._histplot.setAxisScale(QwtPlot.xBottom, hmin, hmax)
self._histplot.setAxisScale(QwtPlot.yRight, 0, 1 + self.ColorBarHeight)
# update curves
# call _setHistLogScale() (with current setting) to update axis scales and set data
self._setHistLogScale(self._ylogscale, replot=False)
# set plot lines
self._line_0.line.setData([0, 0], [0, 1])
self._line_0.marker.setValue(0, 0)
self._line_maxbin.line.setData([self._hist_peak, self._hist_peak], [0, 1])
self._line_maxbin.marker.setValue(self._hist_peak, 0)
self._line_maxbin.setText(("max bin:" + DataValueFormat) % self._hist_peak)
# set half-max line
self._line_halfmax.line.setData(self._hist_range, [self._hist_max / 2, self._hist_max / 2])
self._line_halfmax.marker.setValue(hmin, self._hist_max / 2)
# update ITF
self._updateITF()
def _updateStats(self, subset, minmax):
"""Recomputes subset statistics."""
if subset.size <= (2048 * 2048):
self._showMeanStd(busy=False)
else:
self._wlab_stats.setText(
("min: %s max: %s np: %d" % (DataValueFormat, DataValueFormat, self._subset.size)) % minmax)
self._wmore_stats.show()
def _updateDataSubset(self, subset, minmax, desc, subset_type):
"""Called when the displayed data subset is changed. Updates the histogram."""
self._subset = subset
self._subset_range = minmax
self._wlab_subset.setText("Subset: %s" % desc)
self._hist = self._hist_hires = None
self._wreset_full.setVisible(subset_type is not RenderControl.SUBSET_FULL)
self._wreset_slice and self._wreset_slice.setVisible(subset_type is not RenderControl.SUBSET_SLICE)
# hide the mean/std markers, they will only be shown when _showMeanStd() is called
self._line_mean.hide()
self._line_std.hide()
示例3: qwtchart
# 需要导入模块: from PyQt4.Qwt5 import QwtPlot [as 别名]
# 或者: from PyQt4.Qwt5.QwtPlot import replot [as 别名]
class qwtchart(chart):
colours = {'red' : Qt.red,
'green' : Qt.green,
'blue' : Qt.blue,
'yellow' : Qt.yellow,
'magenta': Qt.magenta,
'black' : Qt.black}
styles = {'-' : Qt.SolidLine,
'--': Qt.DashLine,
':' : Qt.DotLine,
'-.': Qt.DashDotLine}
def getPen(self, colour, style):
return QPen(self.colours[colour], 1, self.styles[style])
def __init__(self, spurset, fef, parent):
chart.__init__(self, spurset, fef, parent)
self.plot = QwtPlot(parent)
self.plot.setAxisScale(xaxis, self.spurset.RFmin,
self.spurset.RFmax)
self.plot.setAxisScale(yaxis, -self.spurset.dspan/2,
self.spurset.dspan/2)
self.plot.setCanvasBackground(Qt.white)
grid = QwtPlotGrid()
grid.setMajPen(QPen(Qt.black, 1, Qt.DotLine))
grid.attach(self.plot)
self.plot.insertLegend(QwtLegend(self.parent), QwtPlot.ExternalLegend)
# a picker to be used for the front-end filter parallelogram
self.picker = QwtPlotPicker(xaxis, yaxis,
QwtPicker.PointSelection,
QwtPlotPicker.NoRubberBand,
QwtPicker.AlwaysOff,
self.plot.canvas())
# gonna need this to implement ondrop()
self._mouseRelease = self.picker.widgetMouseReleaseEvent
self._picked_obj = None
self.picker.connect(self.picker, SIGNAL('appended(const QPoint&)'),
self.onpick)
self.picker.connect(self.picker, SIGNAL('moved(const QPoint&)'),
self.ondrag)
# all about the monkey-patching
self.picker.widgetMouseReleaseEvent = self.ondrop
def redraw(self):
xscale = self.plot.axisScaleDiv(xaxis)
yscale = self.plot.axisScaleDiv(yaxis)
#TODO check if it hurts to just set the scales every time, as in mpl
if (xscale.lowerBound() != self.spurset.RFmin or
xscale.upperBound() != self.spurset.RFmax):
self.plot.setAxisScale(xaxis, self.spurset.RFmin,
self.spurset.RFmax)
if (yscale.lowerBound() != -self.spurset.dspan/2 or
yscale.upperBound() != self.spurset.dspan/2):
self.plot.setAxisScale(yaxis, -self.spurset.dspan/2,
self.spurset.dspan/2)
self.plot.replot()
def mkline(self, xdata, ydata, style=('black','-'), title=''):
line = QwtPlotCurve(title)
if title is '':
# don't display it in the legend
# kind of ugly, that the title variable is doing double duty
line.setItemAttribute(QwtPlotItem.Legend, False)
pen = self.getPen(*style)
line.setPen(pen)
line.setRenderHint(QwtPlotItem.RenderAntialiased)
line.setData(xdata, ydata)
return line
def add_line(self, line):
line.attach(self.plot)
def del_line(self, line):
line.detach()
def legend(self):
return self.plot.legend()
def _xval(self, pos):
# from a QPoint referring to a pixel on the plot, find the x value
return self.plot.invTransform(xaxis, pos.x())
def _yval(self, pos):
# from a QPoint referring to a pixel on the plot, find the y value
return self.plot.invTransform(yaxis, pos.y())
def onpick(self, pos):
# for now, we only worry about picking the two vertical lines of the
# front-end filter parallelogram. Other clicks are no-ops.
if abs(pos.x() - self.plot.transform(xaxis, self.fef.start)) <= 10:
# TODO check pos.y() as well
self._picked_obj = self.fef.startline
self.pick(self.fef.startline, self._xval(pos), self._yval(pos))
elif abs(pos.x() - self.plot.transform(xaxis, self.fef.stop)) <= 10:
self._picked_obj = self.fef.stopline
#.........这里部分代码省略.........