本文整理汇总了Python中qwt.QwtPlotCurve.setRenderHint方法的典型用法代码示例。如果您正苦于以下问题:Python QwtPlotCurve.setRenderHint方法的具体用法?Python QwtPlotCurve.setRenderHint怎么用?Python QwtPlotCurve.setRenderHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qwt.QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve.setRenderHint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from qwt import QwtPlotCurve [as 别名]
# 或者: from qwt.QwtPlotCurve import setRenderHint [as 别名]
def __init__(self, title, xdata, ydata, style, symbol=None, *args):
super(BMPlot, self).__init__(*args)
self.setMinimumSize(200, 200)
self.setTitle(title)
self.setAxisTitle(QwtPlot.xBottom, 'x')
self.setAxisTitle(QwtPlot.yLeft, 'y')
curve = QwtPlotCurve()
curve.setPen(QPen(get_curve_color()))
curve.setStyle(style)
curve.setRenderHint(QwtPlotCurve.RenderAntialiased)
if symbol is not None:
curve.setSymbol(symbol)
curve.attach(self)
curve.setData(xdata, ydata)
self.replot()
示例2: create_log_plot
# 需要导入模块: from qwt import QwtPlotCurve [as 别名]
# 或者: from qwt.QwtPlotCurve import setRenderHint [as 别名]
def create_log_plot():
plot = QwtPlot('LogCurveDemo.py (or how to handle -inf values)')
plot.enableAxis(QwtPlot.xBottom)
plot.setAxisScaleEngine(QwtPlot.yLeft, QwtLogScaleEngine())
curve = QwtPlotCurve()
curve.setRenderHint(QwtPlotCurve.RenderAntialiased)
pen = QPen(Qt.magenta)
pen.setWidth(1.5)
curve.setPen(pen)
curve.attach(plot)
x = np.arange(0.0, 10.0, 0.1)
y = 10*np.cos(x)**2-.1
print("y<=0:", y<=0)
curve.setData(x, y)
plot.replot()
return plot
示例3: BodePlot
# 需要导入模块: from qwt import QwtPlotCurve [as 别名]
# 或者: from qwt.QwtPlotCurve import setRenderHint [as 别名]
class BodePlot(QwtPlot):
def __init__(self, *args):
QwtPlot.__init__(self, *args)
self.setTitle('Frequency Response of a 2<sup>nd</sup>-order System')
self.setCanvasBackground(Qt.darkBlue)
# legend
legend = QwtLegend()
legend.setFrameStyle(QFrame.Box | QFrame.Sunken)
self.insertLegend(legend, QwtPlot.BottomLegend)
# grid
self.grid = QwtPlotGrid()
self.grid.enableXMin(True)
self.grid.attach(self)
# axes
self.enableAxis(QwtPlot.yRight)
self.setAxisTitle(QwtPlot.xBottom, '\u03c9/\u03c9<sub>0</sub>')
self.setAxisTitle(QwtPlot.yLeft, 'Amplitude [dB]')
self.setAxisTitle(QwtPlot.yRight, 'Phase [\u00b0]')
self.setAxisMaxMajor(QwtPlot.xBottom, 6)
self.setAxisMaxMinor(QwtPlot.xBottom, 10)
self.setAxisScaleEngine(QwtPlot.xBottom, QwtLogScaleEngine())
# curves
self.curve1 = QwtPlotCurve('Amplitude')
self.curve1.setRenderHint(QwtPlotItem.RenderAntialiased);
self.curve1.setPen(QPen(Qt.yellow))
self.curve1.setYAxis(QwtPlot.yLeft)
self.curve1.attach(self)
self.curve2 = QwtPlotCurve('Phase')
self.curve2.setRenderHint(QwtPlotItem.RenderAntialiased);
self.curve2.setPen(QPen(Qt.cyan))
self.curve2.setYAxis(QwtPlot.yRight)
self.curve2.attach(self)
# alias
fn = self.fontInfo().family()
# marker
self.dB3Marker = m = QwtPlotMarker()
m.setValue(0.0, 0.0)
m.setLineStyle(QwtPlotMarker.VLine)
m.setLabelAlignment(Qt.AlignRight | Qt.AlignBottom)
m.setLinePen(QPen(Qt.green, 2, Qt.DashDotLine))
text = QwtText('')
text.setColor(Qt.green)
text.setBackgroundBrush(Qt.red)
text.setFont(QFont(fn, 12, QFont.Bold))
m.setLabel(text)
m.attach(self)
self.peakMarker = m = QwtPlotMarker()
m.setLineStyle(QwtPlotMarker.HLine)
m.setLabelAlignment(Qt.AlignRight | Qt.AlignBottom)
m.setLinePen(QPen(Qt.red, 2, Qt.DashDotLine))
text = QwtText('')
text.setColor(Qt.red)
text.setBackgroundBrush(QBrush(self.canvasBackground()))
text.setFont(QFont(fn, 12, QFont.Bold))
m.setLabel(text)
m.setSymbol(QwtSymbol(QwtSymbol.Diamond,
QBrush(Qt.yellow),
QPen(Qt.green),
QSize(7,7)))
m.attach(self)
# text marker
m = QwtPlotMarker()
m.setValue(0.1, -20.0)
m.setLabelAlignment(Qt.AlignRight | Qt.AlignBottom)
text = QwtText(
'[1-(\u03c9/\u03c9<sub>0</sub>)<sup>2</sup>+2j\u03c9/Q]'
'<sup>-1</sup>'
)
text.setFont(QFont(fn, 12, QFont.Bold))
text.setColor(Qt.blue)
text.setBackgroundBrush(QBrush(Qt.yellow))
text.setBorderPen(QPen(Qt.red, 2))
m.setLabel(text)
m.attach(self)
self.setDamp(0.01)
def showData(self, frequency, amplitude, phase):
self.curve1.setData(frequency, amplitude)
self.curve2.setData(frequency, phase)
def showPeak(self, frequency, amplitude):
self.peakMarker.setValue(frequency, amplitude)
label = self.peakMarker.label()
label.setText('Peak: %4g dB' % amplitude)
self.peakMarker.setLabel(label)
#.........这里部分代码省略.........
示例4: __init__
# 需要导入模块: from qwt import QwtPlotCurve [as 别名]
# 或者: from qwt.QwtPlotCurve import setRenderHint [as 别名]
def __init__(self, *args):
QFrame.__init__(self, *args)
self.xMap = QwtScaleMap()
self.xMap.setScaleInterval(-0.5, 10.5)
self.yMap = QwtScaleMap()
self.yMap.setScaleInterval(-1.1, 1.1)
# frame style
self.setFrameStyle(QFrame.Box | QFrame.Raised)
self.setLineWidth(2)
self.setMidLineWidth(3)
# calculate values
self.x = np.arange(0, 10.0, 10.0/27)
self.y = np.sin(self.x)*np.cos(2*self.x)
# make curves with different styles
self.curves = []
self.titles = []
# curve 1
self.titles.append('Style: Sticks, Symbol: Ellipse')
curve = QwtPlotCurve()
curve.setPen(QPen(Qt.red))
curve.setStyle(QwtPlotCurve.Sticks)
curve.setSymbol(QwtSymbol(QwtSymbol.Ellipse,
QBrush(Qt.yellow),
QPen(Qt.blue),
QSize(5, 5)))
self.curves.append(curve)
# curve 2
self.titles.append('Style: Lines, Symbol: None')
curve = QwtPlotCurve()
curve.setPen(QPen(Qt.darkBlue))
curve.setStyle(QwtPlotCurve.Lines)
self.curves.append(curve)
# curve 3
self.titles.append('Style: Lines, Symbol: None, Antialiased')
curve = QwtPlotCurve()
curve.setPen(QPen(Qt.darkBlue))
curve.setStyle(QwtPlotCurve.Lines)
curve.setRenderHint(QwtPlotItem.RenderAntialiased)
self.curves.append(curve)
# curve 4
self.titles.append('Style: Steps, Symbol: None')
curve = QwtPlotCurve()
curve.setPen(QPen(Qt.darkCyan))
curve.setStyle(QwtPlotCurve.Steps)
self.curves.append(curve)
# curve 5
self.titles.append('Style: NoCurve, Symbol: XCross')
curve = QwtPlotCurve()
curve.setStyle(QwtPlotCurve.NoCurve)
curve.setSymbol(QwtSymbol(QwtSymbol.XCross,
QBrush(),
QPen(Qt.darkMagenta),
QSize(5, 5)))
self.curves.append(curve)
# attach data, using Numeric
for curve in self.curves:
curve.setData(self.x, self.y)