本文整理汇总了Python中qwt.QwtPlotCurve.setYAxis方法的典型用法代码示例。如果您正苦于以下问题:Python QwtPlotCurve.setYAxis方法的具体用法?Python QwtPlotCurve.setYAxis怎么用?Python QwtPlotCurve.setYAxis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qwt.QwtPlotCurve
的用法示例。
在下文中一共展示了QwtPlotCurve.setYAxis方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: BodePlot
# 需要导入模块: from qwt import QwtPlotCurve [as 别名]
# 或者: from qwt.QwtPlotCurve import setYAxis [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)
#.........这里部分代码省略.........